/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ui;

import engine.ani.Player;
import engine.damage.Damage;
import engine.net.NetManager;
import javax.microedition.io.ConnectionNotFoundException;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
import mainpackage.Constant;
import mainpackage.GameBean;
import mainpackage.InputInterFace;
import mainpackage.LocalMsgManager;
import mainpackage.MainCanvas;
import mainpackage.MainGame;
import mainpackage.MainLogic;
import mainpackage.MainView;
import mainpackage.ResManager;
import mainpackage.Rms;
//#if NOKIAN73 || NOKIA_S40V3  || NORMAL_240_400 || MOTO || K790
//#else
import mainpackage.SoundPlayerUtil;
//#endif
import mainpackage.Tools;

/**
 *
 * @author Administrator
 */
public class UiLogin {

    public static byte byUiState;
    public boolean bFlag;
    public String[] sArray;
    public String[] sStrArray;
    public boolean bUiKeyPressLock;
    public int iState;
    private Image[] imgArray;
    private int iPositionY;
    private long lLastSysTime;
    public int[] iLineConfigArray;
    public int iSelectIndex = 1;
    private int iSubSelectIndex = 1;
    public int[] iArray;
    private Player[] animation;
    private int[] iMenuArray;
    public byte bySelectIndex;
    private int selectNum;
    public String[] sDataArray;
    private int iAniCountIndex;
    public byte byPopState = 0;
    private int[][] iData;
    private String[][] sData;
    private int startX;
    public int startY;
    private int selectColor = 0x00CCFF;
    private int blackColor = 0x000000;
    private int whiteColor = 0xFFFFFF;
    public int h;
    private int offy;
    //#if NOKIAN73 || NOKIA_S40V3 || NORMAL_240_400 || MOTO || K790
    //#else
    SoundPlayerUtil soundPlayer = new SoundPlayerUtil();
    //#endif

    /**
     * 初始化加载公司logo
     */
    public void initLogo() {
        this.byUiState = 0;
        this.bFlag = false;
        //帧计数数组
        this.iArray = new int[]{0, 255, 0, 0};
        cloud = new int[]{-120, -180, -240, -120, -180, 240, 420};
        this.sArray = new String[]{"是否开启声音？", "音乐开", "音乐关"};
//        if (!Rms.loadGame(Constant.RMS_PLAYER_NETWORK)) {
//            GameBean.BY_NET_CONNECT = -1;
//        }
        try {
            //#if NOKIA_S60V5
             // 图片资源
             this.imgArray = new Image[6];
             this.imgArray[0] = ResManager.createImage(90000035);//一门楼游戏logo
             this.imgArray[1] = Tools.createPicFromGrayscale(ResManager.createImage(90000019), -1);            //四个角落的阴影图片
             this.imgArray[2] = Tools.makeTransparent(this.imgArray[0], 0);//公司logo的遮罩层，产生淡入淡出的效果
             this.imgArray[3] = ResManager.createImage(90000020);//游戏封面图片
             this.imgArray[4] = Tools.makeTransparent(Constant.DRAW_WIDTH, 20, 255, 0xFFFFFF);//游戏封面渐变图片
             this.imgArray[5] = ResManager.createImage(90000074);
            //#else
//#            //图片资源
//#            this.imgArray = new Image[8];
//#            //ui图片
//#            this.imgArray[0] = ResManager.createImage(90000035);
//#            //四个角落的阴影图片
//#//            this.imgArray[1] = Tools.createPicFromGrayscale(ResManager.createImage(90000019), -1);
//#            //公司logo的遮罩层，产生淡入淡出的效果
//#            this.imgArray[2] = Tools.makeTransparent(this.imgArray[0], 0);
//#            //游戏封面图片
//#            this.imgArray[3] = Tools.makeTransparent(ResManager.createImage(90000020), 255);
//#            //游戏封面渐变图片
//#            this.imgArray[4] = Tools.makeTransparent(Constant.DRAW_WIDTH, 20, 255, 0xFFFFFF);
//#            //游戏logo的渐变图片
//#            this.imgArray[5] = ResManager.createImage(90000073);
            //#if NORMAL_240_400
//#             imgArray[5] = Tools.ZoomImage(imgArray[5], Constant.DRAW_WIDTH, Constant.DRAW_HEIGHT);
            //#endif
//#            this.imgArray[6] = Tools.makeTransparent(this.imgArray[5], 0);
            //#if NOKIA_S40V3 || NORMAL_240_400 || MOTO || K790
            //#else
//#            this.imgArray[7] = ResManager.createImage(90000074);
            //#endif
            //#endif
        } catch (Exception e) {
            if (Constant.DEBUG) {
                e.printStackTrace();
            }
            Tools.printLog("logo加载初始化异常");
        }
    }

    /**
     * 更新logo加载界面
     */
    public void updateLogo() {
        if (Constant.b_QUICK_DEBUG_GAME_UI) {
            MainLogic.getInstance().pushState(Constant.QUICK_TO_GAME_UI, true);
            return;
        }
        switch (this.byUiState) {
            case 0:
                if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_POSITIVE, false)) {//开启音乐
                    byUiState = 2;
                    if (MainLogic.getInstance().uiInterFace.isOpenSound) {
                        //#if NOKIAN73 || NOKIA_S40V3  || NORMAL_240_400  || MOTO || K790
                        //#else
                        soundPlayer.playmusic(0);
                        UiInterFace.SetPlayMusic = true;
                        UiInterFace.firstUiMusic = false;
                        //#endif
                    }
                    //#if NOKIA_S40V3 || NORMAL_240_400  || MOTO || K790
//#                     if (GameBean.BY_NET_CONNECT != -1) {
//#                         MainLogic.getInstance().pushState(Constant.GAME_UI_OPTION_LIST, true);
//#                     } else {
//#                         MainLogic.getInstance().pushState(Constant.GAME_UI_NETWORK_SELECT, true);
//#                     }
                    //#endif

                } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_NEGATIVE, false)) {//关闭音乐
                    byUiState = 2;
                    UiInterFace.SetPlayMusic = false;
                    UiInterFace.firstUiMusic = false;
                    //#if NOKIA_S40V3 || NORMAL_240_400  || MOTO || K790
//#                     if (GameBean.BY_NET_CONNECT != -1) {
//#                         MainLogic.getInstance().pushState(Constant.GAME_UI_OPTION_LIST, true);
//#                     } else {
//#                         MainLogic.getInstance().pushState(Constant.GAME_UI_NETWORK_SELECT, true);
//#                     }
                    //#endif
                }
                break;
            case 1:
                if (this.iArray[0] < 255) {
                    this.iArray[0] = this.iArray[0] + 20 > 255 ? 255 : this.iArray[0] + 20;
                    this.imgArray[2] = Tools.makeTransparent(this.imgArray[0], this.iArray[0]);
                } else if (this.iArray[1] > 0) {
                    this.iArray[1] = this.iArray[1] - 30 > 0 ? this.iArray[1] - 30 : 0;
                    this.imgArray[2] = Tools.makeTransparent(this.imgArray[0], this.iArray[1]);
                    if (this.iArray[1] == 0) {
                        this.byUiState = 2;
                        iArray = new int[]{255, 0, 0, 0};
                    }
                }
                break;
            case 2:
                //改变渐变
                //#if NOKIA_S60V5
                 if (this.iArray[0] > 0) {
                     this.iArray[0] = this.iArray[0] - 20 > 0 ? this.iArray[0] - 20 : 0;
                     this.imgArray[4] = Tools.makeTransparent(Constant.DRAW_WIDTH, 20, this.iArray[0], 0xFFFFFF);
                     return;
                 } else {
//                     if (GameBean.BY_NET_CONNECT != -1) {
                         MainLogic.getInstance().pushState(Constant.GAME_UI_OPTION_LIST, true);
//                     } else {
//                         MainLogic.getInstance().pushState(Constant.GAME_UI_NETWORK_SELECT, true);
//                     }
                 }
                //#else
//#                if (this.iArray[0] > 0) {
//#                    this.iArray[0] = this.iArray[0] - 30 > 0 ? this.iArray[0] - 30 : 0;
//#                    this.imgArray[4] = Tools.makeTransparent(Constant.DRAW_WIDTH, 20, this.iArray[0], 0xFFFFFF);
//#                    return;
//#                }
//#                if (this.iArray[0] == 0) {
//#                    //开始变更logo的透明度
//#                    if (this.iArray[2] < 255) {
//#                        this.iArray[2] = this.iArray[2] + 20 > 255 ? 255 : this.iArray[2] + 20;
//#                        this.imgArray[6] = Tools.makeTransparent(this.imgArray[3], this.iArray[2]);
//#                    }
//#                    if (this.iArray[2] == 255) {
//#                        if (GameBean.BY_NET_CONNECT != -1) {
//#                            MainLogic.getInstance().pushState(Constant.GAME_UI_OPTION_LIST, true);
//#                        } else {
//#                            MainLogic.getInstance().pushState(Constant.GAME_UI_NETWORK_SELECT, true);
//#                        }
//#                    }
//#                }
                //#endif
                break;
        }
    }
    /**
     * 绘制logo界面
     * @param g
     */
    public int W, H;

    public void drawLogo(Graphics g) {
        switch (this.byUiState) {
            case 0:
                //提示
                g.setColor(0x000000);
                int Y = (Constant.SCREEN_HEIGHT - Constant.FONT_SMALL.getHeight() * 4 - 30) / 2;
                for (int i = 0; i < sArray.length-2; i++) {
                    g.drawString(sArray[i], Constant.UI_START_X + ((Constant.DRAW_WIDTH - Constant.FONT_SMALL.stringWidth(sArray[i])) >> 1), Y + (Constant.FONT_SMALL.getHeight() + 10) * i, 0);
                }
//                Tools.drawCorner(g, Constant.UI_START_X, Constant.UI_START_Y, this.imgArray[1]);
                //#if NOKIA_S60V5
                 Tools.drawStrButton(g, sArray[sArray.length-1], sArray[sArray.length-2], 0x000000);
                //#else
//#                Tools.drawStrButton(g, sArray[4], sArray[5], 0x000000);
                //#endif
                break;
            case 1:
                //开始绘制公司logo
                g.drawImage(this.imgArray[2], Constant.UI_START_X + ((Constant.DRAW_WIDTH - this.imgArray[2].getWidth()) >> 1), Constant.UI_START_Y + ((Constant.DRAW_HEIGHT - this.imgArray[2].getHeight()) >> 1), 0);
//                Tools.drawCorner(g, Constant.UI_START_X, Constant.UI_START_Y, this.imgArray[1]);
                break;
            case 2:
                //#if NOKIA_S60V5
                 g.drawImage(this.imgArray[3], Constant.UI_START_X, Constant.UI_START_Y, 0);
                 if (this.iArray[0] > 0) {
                     Tools.drawTilePic(g, (byte) 2, Constant.UI_START_X, Constant.UI_START_Y, Constant.DRAW_HEIGHT, this.imgArray[4], 0, 0, Constant.DRAW_WIDTH, 20, Constant.TRANS_NONE);
                 }
                 drawCloud(g, this.imgArray[5]);
                //#else
//#
//#                //绘制背景图片
                //#if NOKIA_E72
//#                 g.drawImage(this.imgArray[6], Constant.UI_START_X, Constant.UI_START_Y, 0);
                //#else
//#                g.drawImage(this.imgArray[5], Constant.UI_START_X, Constant.UI_START_Y, 0);
//#                if (this.iArray[0] > 0) {
//#                    Tools.drawTilePic(g, (byte) 2, Constant.UI_START_X, Constant.UI_START_Y, Constant.DRAW_HEIGHT, this.imgArray[4], 0, 0, Constant.DRAW_WIDTH, 20, Constant.TRANS_NONE);
//#                } else {
//#                    g.drawImage(this.imgArray[6], Constant.UI_START_X + 31, Constant.UI_START_Y + 19, 0);
//#                }
                //#endif
                //#if NOKIA_S40V3 || NORMAL_240_400  || MOTO || K790
                //#else
//#                drawCloud(g, this.imgArray[7]);
                //#endif
//#//                Tools.drawCorner(g, Constant.UI_START_X, Constant.UI_START_Y, this.imgArray[1]);
                //#endif
                break;
        }
    }
    private int[] cloud;

    private void drawCloud(Graphics g, Image cloudPic) {
        //#if NOKIA_S40V3 || NORMAL_240_400  || MOTO || K790
//#         return;
        //#else
        cloud[0] += 1;
        cloud[1] += 1;
        cloud[2] += 1;
        cloud[3] += 1;
        cloud[4] += 1;
        cloud[5] -= 1;
        cloud[6] -= 1;
        if (cloudPic != null) {
            g.drawImage(cloudPic, cloud[0], Constant.DRAW_HEIGHT - cloudPic.getHeight() - 40, 0);
            g.drawImage(cloudPic, cloud[1], Constant.DRAW_HEIGHT - cloudPic.getHeight() - 20, 0);
            g.drawImage(cloudPic, cloud[2], Constant.DRAW_HEIGHT - cloudPic.getHeight() - 30, 0);
            g.drawImage(cloudPic, cloud[3], (Constant.DRAW_HEIGHT - cloudPic.getHeight()) / 2, 0);
            g.drawImage(cloudPic, cloud[4], 20 + (Constant.DRAW_HEIGHT - cloudPic.getHeight()) / 2, 0);
            g.drawImage(cloudPic, cloud[5], 20, 0);
            g.drawImage(cloudPic, cloud[6], 30, 0);
        }
        if (cloud[0] > 240) {
            cloud[0] = -120;
        }
        if (cloud[1] > 240) {
            cloud[1] = -180;
        }
        if (cloud[2] > 240) {
            cloud[2] = -240;
        }
        if (cloud[3] > 240) {
            cloud[3] = -120;
        }
        if (cloud[4] > 240) {
            cloud[4] = -180;
        }
        if (cloud[5] < -125) {
            cloud[5] = 240;
        }
        if (cloud[6] < -125) {
            cloud[6] = 420;
        }
        //#endif
    }

    /**
     * 清除LOGO界面的资源
     */
    public void clearLogo() {
        this.imgArray = null;
        this.iArray = null;
        this.sArray = null;
        this.cloud = null;
    }
    /*
     * 游戏退出界面
     */
    public int overState;

    public void initOver() {
        overState = 0;
        //#if NOKIA_S60V5
         try {
             this.imgArray = new Image[8];
             this.imgArray[0] = ResManager.createImage(90000041); //小箭头图片
             this.imgArray[1] = Tools.makeBlueMask(); //蓝色选择条
             this.imgArray[2] = ResManager.createImage(90000017);//背景图片
             this.imgArray[3] = Tools.makeTransparent(ResManager.createImage(90000051), 255); //边框图片
             this.imgArray[4] = ResManager.createImage(90000086);//蓝条
             this.imgArray[5] = ResManager.createImage(90000043);  //文字图片
             this.imgArray[6] = ResManager.createImage(90000085);//确认按钮图片
             this.imgArray[7] = ResManager.createImage(90000084);//方向键图片
         } catch (Exception e) {
             e.printStackTrace();
         }
        //#else
//#        imgArray = new Image[4];
//#        try {
//#            //箭头图片
//#            this.imgArray[0] = ResManager.createImage(90000041);
//#            //蓝色光片
//#            this.imgArray[1] = Tools.createPicFromGrayscale(ResManager.createImage(90000029), 0x0099ff);
            //#if NOKIA_S40V3  || MOTO || K790
            //#elif NORMAL_240_400
//# //            imgArray[2] = ResManager.createImage(90000017);
//# //            imgArray[2] = Tools.ZoomImage(imgArray[2], Constant.DRAW_WIDTH, Constant.DRAW_HEIGHT);
            //#else
//#            //背景图片
//#            this.imgArray[2] = ResManager.createImage(90000017);
            //#endif
            //#if NOKIA_E72
//#                     this.imgArray[3] = ResManager.createImage(90000060);
            //#else
//#            //确定返回
//#            this.imgArray[3] = ResManager.createImage(90000043);
            //#endif
//#        } catch (Exception e) {
//#            e.printStackTrace();
//#        }
        //#endif
        sArray = new String[]{"退出游戏", "是否退出游戏", "是否连接",};
        //#if QUDAOID == "DANGLE"
//#         bbsStr = "当乐论坛";
        //#elif QUDAOID == "JIUYOU"
//#         bbsStr = "九游官方网站";
        //#elif QUDAOID == "UC"
//#              bbsStr = "UC官方网站";
        //#else
        bbsStr = "亿门楼官网";
        //#endif
    }
    public String bbsStr;

    public void updateOver() {
        if (overState == 0) {
            if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_POSITIVE, false)
                    || MainCanvas.keyPressedLogic(Constant.GAME_KEY_FIRE, false)
                    || MainCanvas.keyPressedLogic(Constant.GAME_KEY_5, false)) {//
//                if (Constant.QIUT_GAME_STORE_URL == null) {
                    MainGame.instance.quitApp();
//                } else {
//                    overState = 1;
//                }
            }
            if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_NEGATIVE, false)) {//返回
                MainLogic.getInstance().pushState(Constant.GAME_UI_OPTION_LIST, true);
            }
        } else {
            if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_POSITIVE, false)
                    || MainCanvas.keyPressedLogic(Constant.GAME_KEY_FIRE, false)
                    || MainCanvas.keyPressedLogic(Constant.GAME_KEY_5, false)) {//
                try {
                    MainGame.instance.platformRequest(Constant.QIUT_GAME_STORE_URL);
                    try {
                        Thread.sleep(500);
                        MainGame.instance.quitApp();
                    } catch (InterruptedException ex) {
                        MainGame.instance.quitApp();
                        ex.printStackTrace();
                    }
                } catch (ConnectionNotFoundException ex) {
                    MainGame.instance.quitApp();
                    ex.printStackTrace();
                }
//                System.out.println("连接论坛");
            }
            if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_NEGATIVE, false)) {//返回
                MainGame.instance.quitApp();
            }
        }
    }

    public void drawOver(Graphics g) {
        if (imgArray[0] != null) {
            //#if NOKIA_S60V5
             Tools.drawS60V5Frame(g, this.imgArray[2], this.imgArray[7],
                     this.imgArray[6], this.imgArray[4], this.imgArray[5], this.sArray[0]);
             if (overState == 0) {
                 Tools.drawShadowString(g, (byte) 1, sArray[1], (Constant.SCREEN_WIDTH - Constant.FONT_SMALL.stringWidth(sArray[1])) / 2,
                         (Constant.NEW_END_LINE - Constant.FONT_SMALL.getHeight()) / 2,
                         0xffffff, 0x000000);
             } else {
                 Tools.drawShadowString(g, (byte) 1, sArray[2], (Constant.SCREEN_WIDTH - Constant.FONT_SMALL.stringWidth(sArray[2])) / 2,
                         (Constant.NEW_END_LINE - Constant.FONT_SMALL.getHeight()) / 2,
                         0xffffff, 0x000000);
                 Tools.drawShadowString(g, (byte) 1, bbsStr, (Constant.SCREEN_WIDTH - Constant.FONT_SMALL.stringWidth(bbsStr)) / 2,
                         (Constant.NEW_END_LINE - Constant.FONT_SMALL.getHeight()) / 2 + Constant.FONT_SMALL.getHeight() + 5,
                         0xffffff, 0x000000);
             }
            //#else
//#            Tools.drawFrame(g,
//#                    Constant.UI_START_X, Constant.UI_START_Y,
//#                    this.imgArray[2],
//#                    this.imgArray[0],
//#                    this.imgArray[1],
//#                    this.imgArray[3],
//#                    0, 0, 24, 12,
//#                    this.imgArray[3], 49, 0, 23, 12,
//#                    sArray[0], 0xFFFFFF);
//#            if (overState == 0) {
//#                Tools.drawShadowString(g, (byte) 1, sArray[1], (Constant.SCREEN_WIDTH - Constant.FONT_SMALL.stringWidth(sArray[1])) / 2,
//#                        (Constant.SCREEN_HEIGHT - Constant.FONT_SMALL.getHeight()) / 2,
//#                        0xffffff, 0x000000);
//#            } else {
//#                Tools.drawShadowString(g, (byte) 1, sArray[2], (Constant.SCREEN_WIDTH - Constant.FONT_SMALL.stringWidth(sArray[2])) / 2,
//#                        (Constant.SCREEN_HEIGHT - Constant.FONT_SMALL.getHeight()) / 2,
//#                        0xffffff, 0x000000);
//#                Tools.drawShadowString(g, (byte) 1, bbsStr, (Constant.SCREEN_WIDTH - Constant.FONT_SMALL.stringWidth(bbsStr)) / 2,
//#                        (Constant.SCREEN_HEIGHT - Constant.FONT_SMALL.getHeight()) / 2 + Constant.FONT_SMALL.getHeight() + 5,
//#                        0xffffff, 0x000000);
//#            }
//#endif
        }
    }

    public void clearOver() {
        sArray = null;
        imgArray = null;
    }
    /*
     * 初始化游戏选项界面
     */

    public void initOptionList() {
        MainCanvas.clearInput();
        GameBean.BY_QUICK_ENTER = 0;
        Rms.loadGame(Constant.RMS_QUICK_STATUS);
//        System.out.println(" GameBean.BY_QUICK_ENTER =" + GameBean.BY_QUICK_ENTER);
        this.byUiState = 0;
        this.bFlag = false;
        this.iSelectIndex = 6;
        this.bUiKeyPressLock = false;
        this.iState = 0;
        this.sArray = new String[]{"", "", "用户:", "密码："};
        cloud = new int[]{-120, -180, -240, -120, -180, 240, 420};
        try {
            //图片资源
            //#if NOKIA_S60V5
             this.imgArray = new Image[7];            //ui图片
             this.imgArray[0] = Tools.createPicFromGrayscale(ResManager.createImage(90000019), -1);            //游戏封面图片
             this.imgArray[1] = ResManager.createImage(90000020);//游戏封面
             this.imgArray[2] = ResManager.createImage(90000055);  //游戏文字
             this.imgArray[3] = ResManager.createImage(90000021); //版权图片
             this.imgArray[4] = ResManager.createImage(90000083);//箭头
             this.imgArray[5] = ResManager.createImage(90000074);//云彩
             this.imgArray[6] = ResManager.createImage(90000085);//确认按键
            //#else
//#            this.imgArray = new Image[8];
            //#if NOKIA_S40V3  || MOTO || K790
            //#else
//#            //ui图片
//#            this.imgArray[0] = Tools.createPicFromGrayscale(ResManager.createImage(90000019), -1);
            //#endif
//#            //游戏封面图片
//#            this.imgArray[1] = Tools.makeTransparent(ResManager.createImage(90000020), 255);
//#            //新的冒险背景图片
//#//            this.imgArray[2] = Tools.makeTransparent(ResManager.createImage(90000061), 60);
//#            //版权图片
//#            this.imgArray[3] = ResManager.createImage(90000021);
//#            //箭头
//#            this.imgArray[4] = ResManager.createImage(90000041);
//#
//#            this.imgArray[5] = ResManager.createImage(90000055);
//#            this.imgArray[6] = ResManager.createImage(90000073);
            //#if NORMAL_240_400
//#             imgArray[6] = Tools.ZoomImage(imgArray[6], Constant.DRAW_WIDTH, Constant.DRAW_HEIGHT);
            //#endif
            //#if NOKIA_S40V3 || NORMAL_240_400  || MOTO || K790
            //#else
//#            this.imgArray[7] = ResManager.createImage(90000074);
            //#endif
            //#endif
            Rms.loadGame(Constant.RMS_LOGIN_USENAME_PASSWORD);
            this.sArray[0] = GameBean.STR_CMD_LOGIN_USENAME;
            this.sArray[1] = GameBean.STR_CMD_LOGIN_PASSWORD;
            if (GameBean.BY_QUICK_ENTER == 1) {
                iSelectIndex = 4;
            }
        } catch (Exception e) {
            if (Constant.DEBUG) {
                e.printStackTrace();
            }
            Tools.printLog("登录界面资源图片载入图片异常");
        }
    }
    /*
     * 更新游戏选项界面
     */
    public static String quickname, quickpassword;

    public void updateOptionList() {
        switch (this.byUiState) {
            case 0:
                if (!bUiKeyPressLock) {
                    if (iSelectIndex == 6 && (MainCanvas.keyPressedLogic(Constant.GAME_KEY_POSITIVE, false)
                            || MainCanvas.keyPressedLogic(Constant.GAME_KEY_FIRE, false)
                            || MainCanvas.keyPressedLogic(Constant.GAME_KEY_5, false))) {//登陆
                        //#if NOKIA_S40V3 || NORMAL_240_400  || MOTO || K790
                        //#if USER_CENTER == "TRUE"
                        //#else
//#                              NetManager.getNewInstance().startNetManager();
                        //#endif
                        //#endif
                        MainLogic.getInstance().pushState(Constant.GAME_UI_LOGIN, true);
                    } else if (iSelectIndex == 5 && (MainCanvas.keyPressedLogic(Constant.GAME_KEY_POSITIVE, false)
                            || MainCanvas.keyPressedLogic(Constant.GAME_KEY_FIRE, false)
                            || MainCanvas.keyPressedLogic(Constant.GAME_KEY_5, false))) {//注册账号
                        MainLogic.inputInterFace.setInputInterFace(byUiState, "请输入您要注册的用户名和密码");
                        MainGame.changeCanvas(MainLogic.getInstance().inputInterFace);
                    } else if (iSelectIndex == 4 && (MainCanvas.keyPressedLogic(Constant.GAME_KEY_POSITIVE, false)
                            || MainCanvas.keyPressedLogic(Constant.GAME_KEY_FIRE, false)
                            || MainCanvas.keyPressedLogic(Constant.GAME_KEY_5, false))) {//快速注册
                    	bUiKeyPressLock = true;
                        if (GameBean.BY_QUICK_ENTER != 1) {
                            LocalMsgManager.getInstance().httpConnect(Constant.MSG_LOCAL_HTTP_QUICKLOGIN);
                        } else {//快速登录
                            //#if USER_CENTER=="TRUE"
                            LocalMsgManager.getInstance().httpConnect(Constant.MSG_LOCAL_HTTP_LOGIN);
//                            LocalMsgManager.getInstance().httpConnect(Constant.MSG_LOCAL_HTTP_QUICK_ENTER);
                            //#else
//#                             Rms.loadGame(Constant.RMS_LOGIN_USENAME_PASSWORD);
//#                             if (GameBean.STR_CMD_LOGIN_USENAME != null) {
//#                                 ////////////////////////
//#                                 Rms.loadGame(Constant.RMS_PLAYER_ID);
//#                                 if (GameBean.L_CMD_PLAYER_OWN_ID != -1L) {
//#                                     //////////////////
//#                                     Constant.QUICK_GAME = 1;
//#                                     LocalMsgManager.getInstance().httpConnect(Constant.MSG_LOCAL_HTTP_LOGIN);
//#                                     ///////////////////
//#                                     Rms.loadGame(Constant.RMS_PLAYER_INDEX);
//#                                     Rms.loadGame(Constant.RMS_PLAYER_LEVLE);
//#                                     Rms.loadGame(Constant.RMS_PLAYER_SEX);
//#                                     Tools.printLog("Constant.PLAYER_INDEX44   " + Constant.PLAYER_INDEX);
//#                                     switch (Constant.PLAYER_INDEX) {
//#                                         case 1:
//#                                             Rms.loadGame(Constant.RMS_NEW_PLAYER_TUITION_1);
//# //                                            System.out.println("111 :: " + MainLogic.getInstance().uiInterFace.sysMessage.saveStateGuide);
//#                                             Rms.saveGame(Constant.RMS_NEW_PLAYER_TUITION_1, null);
//#                                             break;
//#                                         case 2:
//#                                             Rms.loadGame(Constant.RMS_NEW_PLAYER_TUITION_2);
//# //                                            System.out.println("222 :: " + MainLogic.getInstance().uiInterFace.sysMessage.saveStateGuide);
//#                                             Rms.saveGame(Constant.RMS_NEW_PLAYER_TUITION_2, null);
//#                                             break;
//#                                         case 3:
//#                                             Rms.loadGame(Constant.RMS_NEW_PLAYER_TUITION_3);
//# //                                            System.out.println("333 :: " + MainLogic.getInstance().uiInterFace.sysMessage.saveStateGuide);
//#                                             Rms.saveGame(Constant.RMS_NEW_PLAYER_TUITION_3, null);
//#                                             break;
//#                                         case 4:
//#                                             Rms.loadGame(Constant.RMS_NEW_PLAYER_TUITION_4);
//# //                                            System.out.println("444 :: " + MainLogic.getInstance().uiInterFace.sysMessage.saveStateGuide);
//#                                             Rms.saveGame(Constant.RMS_NEW_PLAYER_TUITION_4, null);
//#                                             break;
//#                                     }
//# //                                //发送登入游戏消息指令
//# //                                MainLogic.getInstance().send(Constant.MSG_NET_ENTER_WORLD, Constant.SOCKET_MSG_TYPE_LOGIC);
//#                                     Tools.printLog("有角色登录");
//#                                 } else {
//#                                     MainLogic.getInstance().uiInterFace.sysMessage.showMessage("提示", "没有创建角色");
//#                                 }
//#                             } else {
//#                                 MainLogic.getInstance().uiInterFace.sysMessage.showMessage("提示", "请先注册用户");
//#                             }
                            //#endif
                        }
                    } else if (iSelectIndex == 3 && (MainCanvas.keyPressedLogic(Constant.GAME_KEY_POSITIVE, false)
                            || MainCanvas.keyPressedLogic(Constant.GAME_KEY_FIRE, false)
                            || MainCanvas.keyPressedLogic(Constant.GAME_KEY_5, false))) {//设置
                        MainLogic.getInstance().pushState(Constant.GAME_UI_SET, true);
                    } else if (iSelectIndex == 2 && (MainCanvas.keyPressedLogic(Constant.GAME_KEY_POSITIVE, false)
                            || MainCanvas.keyPressedLogic(Constant.GAME_KEY_FIRE, false)
                            || MainCanvas.keyPressedLogic(Constant.GAME_KEY_5, false))) {//帮助
                        MainLogic.getInstance().pushState(Constant.GAME_UI_HELP, true);
                    } else if (iSelectIndex == 1 && (MainCanvas.keyPressedLogic(Constant.GAME_KEY_POSITIVE, false)
                            || MainCanvas.keyPressedLogic(Constant.GAME_KEY_FIRE, false)
                            || MainCanvas.keyPressedLogic(Constant.GAME_KEY_5, false))) {//帮助关于
                        MainLogic.getInstance().pushState(Constant.GAME_UI_ABOUT, true);
                    } else if (iSelectIndex == 0 && (MainCanvas.keyPressedLogic(Constant.GAME_KEY_POSITIVE, false)
                            || MainCanvas.keyPressedLogic(Constant.GAME_KEY_FIRE, false)
                            || MainCanvas.keyPressedLogic(Constant.GAME_KEY_5, false))) {
                        //退出
//                        MainGame.instance.quitApp();
                        MainLogic.getInstance().pushState(Constant.GAME_UI_OVER, true);
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_LEFT, false)) {
                        this.iSelectIndex = this.iSelectIndex > 0 ? (this.iSelectIndex - 1) : 6;
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_RIGHT, false)) {
                        this.iSelectIndex = this.iSelectIndex < 6 ? (this.iSelectIndex + 1) : 0;
                    }
                }
                break;
        }
    }

    /*
     * 绘制游戏选项界面
     */
    boolean test = true;

    public void drawOptionList(Graphics g) {
        switch (byUiState) {
            case 0:
                ///文字绘制的起始位置
                //#if NOKIA_S60V5
                 g.drawImage(this.imgArray[1], Constant.UI_START_X, Constant.UI_START_Y, Graphics.LEFT | Graphics.TOP);
                 //绘制文字
                 int imgw = 192;//104;
                 int imgh = 208;//112;
                 int clipw = imgw/8;
                 int cliph = imgh/2;
                 int linespace = clipw + 8;
                 startX = Constant.UI_START_X + (Constant.SCREEN_WIDTH - (linespace*7)>>1);
                 startY = Constant.UI_START_Y + 460;
                 if (imgArray == null || imgArray[2] == null) {
                	 break;
                 }
                 for (byte i = 0; i < 7; i++) {
                     if (GameBean.BY_QUICK_ENTER != 1) {
                         if (i != this.iSelectIndex) {
                             if (i == 4) {
                                 g.drawRegion(this.imgArray[2], 7 * clipw, cliph, clipw, cliph, Constant.TRANS_NONE, startX, startY, Graphics.LEFT | Graphics.TOP);
                             } else {
                                 g.drawRegion(this.imgArray[2], (6 - i) * clipw, cliph, clipw, cliph, Constant.TRANS_NONE, startX, startY, Graphics.LEFT | Graphics.TOP);
                             }

                         } else {
                             if (i == 4) {
                                 g.drawRegion(this.imgArray[2], 7 * clipw, 0, clipw, cliph, Constant.TRANS_NONE, startX, startY - 3, Graphics.LEFT | Graphics.TOP);
                             } else {
                                 g.drawRegion(this.imgArray[2], (6 - i) * clipw, 0, clipw, cliph, Constant.TRANS_NONE, startX, startY - 3, Graphics.LEFT | Graphics.TOP);
                             }

                         }
                     } else {
                         if (i != this.iSelectIndex) {
                             g.drawRegion(this.imgArray[2], (6 - i) * clipw, cliph, clipw, cliph, Constant.TRANS_NONE, startX, startY, Graphics.LEFT | Graphics.TOP);
                         } else {
                             g.drawRegion(this.imgArray[2], (6 - i) * clipw, 0, clipw, cliph, Constant.TRANS_NONE, startX, startY - 3, Graphics.LEFT | Graphics.TOP);
                         }
                     }
 //                    if (i != this.iSelectIndex) {
 //                        g.drawRegion(this.imgArray[2], (6 - i) * 13, 56, 13, 56, Constant.TRANS_NONE, startX, startY, Graphics.LEFT | Graphics.TOP);
 //                    } else {
 //                        g.drawRegion(this.imgArray[2], (6 - i) * 13, 0, 13, 56, Constant.TRANS_NONE, startX, startY - 3, Graphics.LEFT | Graphics.TOP);
 //                    }
                     startX += linespace;
                 }
//                 g.drawImage(this.imgArray[4], Constant.UI_START_X + 67, Constant.UI_START_Y + 466, Graphics.LEFT | Graphics.TOP);
//                 g.drawRegion(this.imgArray[4], 0, 0, this.imgArray[4].getWidth(), this.imgArray[4].getHeight(), Constant.TRANS_ROT180, Constant.UI_START_X + 270, Constant.UI_START_Y + 466, Graphics.LEFT | Graphics.TOP);
                 g.drawImage(this.imgArray[3], Constant.UI_START_X + (Constant.DRAW_WIDTH - this.imgArray[3].getWidth()) / 2, Constant.UI_START_Y + 617, Graphics.LEFT | Graphics.TOP);
                 //绘制确认按键
                 //g.drawImage(this.imgArray[6], Constant.UI_START_X + (Constant.DRAW_WIDTH - this.imgArray[6].getWidth()) / 2, Constant.UI_START_Y + 520, Graphics.LEFT | Graphics.TOP);
//                 g.drawRegion(this.imgArray[6], 91, 0, 91, 92, Constant.TRANS_NONE, Constant.UI_START_X + (Constant.DRAW_WIDTH - 91) / 2, Constant.UI_START_Y + 520, Graphics.LEFT | Graphics.TOP);
                 drawCloud(g, this.imgArray[5]);
                //#else
//#                //游戏封面
//#                g.drawImage(this.imgArray[6], Constant.UI_START_X, Constant.UI_START_Y, Graphics.LEFT | Graphics.TOP);
//#                //游戏封面
                //#if NOKIA_E72
//#                 g.drawImage(this.imgArray[1], Constant.UI_START_X, Constant.UI_START_Y, Graphics.LEFT | Graphics.TOP);
                //#else
//#                g.drawImage(this.imgArray[1], Constant.UI_START_X + 31, Constant.UI_START_Y + 19, Graphics.LEFT | Graphics.TOP);
                //#endif
//#                //版权图片1
//#                g.drawImage(this.imgArray[3], (Constant.DRAW_WIDTH - this.imgArray[3].getWidth()) / 2, 303, Graphics.LEFT | Graphics.TOP);
//#                drawCloud(g, this.imgArray[7]);
//#                g.setClip(0, 0, Constant.DRAW_WIDTH, Constant.DRAW_HEIGHT);
//#                //绘制两个箭头
//#                //绘制选项
//#                int W = 5;
                //#if NOKIA_E72
//#                 int start_x = 20;
//#                 int start_y = 170;
                //#else
//#                int start_x = (Constant.DRAW_WIDTH - this.imgArray[5].getWidth() / 2 - W * 5) / 2;
//#                int start_y = 246;
                //#endif
                //#if NOKIA_E72
//#                 startX = 20;
//#                 startY = 170;
//#                 for (byte i = 0; i < 7; i++) {
//#                     if (GameBean.BY_QUICK_ENTER !=1) {
//#                         if (i != this.iSelectIndex) {
//#                             if (i == 4) {
//#                                 g.drawRegion(this.imgArray[5], 7 * 13, 56, 13, 56, Constant.TRANS_NONE, startX, startY, Graphics.LEFT | Graphics.TOP);
//#                             } else {
//#                                 g.drawRegion(this.imgArray[5], (6 - i) * 13, 56, 13, 56, Constant.TRANS_NONE, startX, startY, Graphics.LEFT | Graphics.TOP);
//#                             }
//#
//#                         } else {
//#                             if (i == 4) {
//#                                 g.drawRegion(this.imgArray[5], 7 * 13, 0, 13, 56, Constant.TRANS_NONE, startX, startY - 3, Graphics.LEFT | Graphics.TOP);
//#                             } else {
//#                                 g.drawRegion(this.imgArray[5], (6 - i) * 13, 0, 13, 56, Constant.TRANS_NONE, startX, startY - 3, Graphics.LEFT | Graphics.TOP);
//#                             }
//#
//#                         }
//#                     } else {
//#                         if (i != this.iSelectIndex) {
//#                             g.drawRegion(this.imgArray[5], (6 - i) * 13, 56, 13, 56, Constant.TRANS_NONE, startX, startY, Graphics.LEFT | Graphics.TOP);
//#                         } else {
//#                             g.drawRegion(this.imgArray[5], (6 - i) * 13, 0, 13, 56, Constant.TRANS_NONE, startX, startY - 3, Graphics.LEFT | Graphics.TOP);
//#                         }
//#                     }
//#                     startX += 22;
//#                 }
                //#else
//#                for (int i = 0; i < 7; i++) {
//#                    if (iSelectIndex != i) {
//#                        if (GameBean.BY_QUICK_ENTER != 1) {
//#                            if (i == 4) {
//#                                g.drawRegion(this.imgArray[5], this.imgArray[5].getWidth() / 2 + 7 * 11, 0, 11, 43, Constant.TRANS_NONE, start_x + (W + 11) * i, start_y, 0);
//#                            } else {
//#                                g.drawRegion(this.imgArray[5], this.imgArray[5].getWidth() / 2 + i * 11, 0, 11, 43, Constant.TRANS_NONE, start_x + (W + 11) * i, start_y, 0);
//#                            }
//#                        } else {
//#                            g.drawRegion(this.imgArray[5], this.imgArray[5].getWidth() / 2 + i * 11, 0, 11, 43, Constant.TRANS_NONE, start_x + (W + 11) * i, start_y, 0);
//#                        }
//#
//#                    }
//#                }
//#                if (GameBean.BY_QUICK_ENTER != 1) {
//#                    if (iSelectIndex == 4) {
//#                        g.drawRegion(this.imgArray[5], (iSelectIndex + 3) * 11, 0, 11, 43, Constant.TRANS_NONE, start_x + (W + 11) * iSelectIndex + 1, start_y - 1, 0);
//#                    } else {
//#                        g.drawRegion(this.imgArray[5], iSelectIndex * 11, 0, 11, 43, Constant.TRANS_NONE, start_x + (W + 11) * iSelectIndex + 1, start_y - 1, 0);
//#                    }
//#                } else {
//#                    g.drawRegion(this.imgArray[5], iSelectIndex * 11, 0, 11, 43, Constant.TRANS_NONE, start_x + (W + 11) * iSelectIndex + 1, start_y - 1, 0);
//#                }
                //#endif
//#                //四个角落阴影图片
//#//                Tools.drawCorner(g, Constant.UI_START_X, Constant.UI_START_Y, imgArray[0]);
                //#if NOKIA_S40V3 || NORMAL_240_400  || MOTO || K790
                //#else
//#                drawCloud(g, this.imgArray[7]);
                //#endif
                //#endif
                if (this.byUiState == 3) {
                    g.setColor(0xFFFFFF);
                    //#if NOKIA_S60V5
                     g.drawString(this.sArray[4], Constant.UI_START_X + ((Constant.DRAW_WIDTH - Constant.FONT_SMALL.stringWidth(this.sArray[4]) >> 1)), Constant.UI_START_Y + 470, 0);
                    //#else
//#                    g.drawString(this.sArray[4], Constant.UI_START_X + ((Constant.DRAW_WIDTH - Constant.FONT_SMALL.stringWidth(this.sArray[4]) >> 1)), Constant.UI_START_Y + 250, 0);
                    //#endif
                }
                MainView.drawTouchRect(g, moptionListrect);
                break;
            case 1:
                break;
            default:
                break;
        }
    }
    private int[][] moptionListrect;
    public void checkTouchOptionList(int x, int y) {
    	if (moptionListrect == null) {
    		moptionListrect = new int[7][];
    		 int imgw = 192;//104;
             int imgh = 208;//112;
             int clipw = imgw/8;
             int cliph = imgh/2;
             int linespace = clipw + 8;
             int startX = Constant.UI_START_X + (Constant.SCREEN_WIDTH - (linespace*7)>>1);
             int startY = Constant.UI_START_Y + 460;
             for (byte i = 0; i < 7; i++) {
            	 moptionListrect[i] = new int[]{startX + i*linespace-4,startY,linespace,cliph};
             }
    	}
//    	int[][] option = (int[][]) s_uiTouch.get(key);
//		if (option == null) {
//			option = new int[7][];
//			for (int i = 0; i < 7; i++) {
//				option[i] = new int[] { 108 + i * 22, 450, 22, 68 };
//			}
//			s_uiTouch.put(key, option);
//		}
		int touched = MainCanvas.checkTouch(x, y, moptionListrect);
		if (touched >= 0 && MainLogic.uiLogin != null) {
			if (MainLogic.uiLogin.iSelectIndex == touched) {
				MainCanvas.pressFire();
			} else {
				iSelectIndex = touched;
			}
		}
    }

    /*
     * 清除游戏选项界面资源
     */
    public void clearOptionList() {
        this.imgArray = null;
        this.sArray = null;
        this.cloud = null;
    }

    /**
     * 初始化登录界面资源
     */
    public void initLogin() {
        try {
            this.byUiState = 0;
            this.bFlag = false;
            this.sArray = new String[]{"", "", "用户：", "密码："};
            this.bUiKeyPressLock = true;
            this.iState = 0;
            //图片资源
            //弹出层的UI
            //#if NOKIA_S60V5
             imgArray = new Image[12];
             imgArray[0] = Tools.makeTransparent(ResManager.createImage(90000051), 255);//弹出层图片
             imgArray[1] = Tools.makeTransparent(10, 91, 200, 0x989898);//背景颜色层
             imgArray[2] = ResManager.createImage(90000017);//游戏封面图片
             imgArray[3] = Tools.makeBlueMask();//蓝色的图片
             imgArray[4] = ResManager.createImage(90000041);//箭头
             imgArray[5] = ResManager.createImage(90000043);//确定，取消
             imgArray[6] = ResManager.createImage(90000021);//版权图片
             imgArray[7] = ResManager.createImage(90000025);//登录，注册
             imgArray[8] = Tools.createPicFromGrayscale(ResManager.createImage(90000019), -1);//四个角落的阴影图片
             imgArray[9] = ResManager.createImage(90000084);//方向键
             imgArray[10] = ResManager.createImage(90000085);//确定键
             imgArray[11] = ResManager.createImage(90000086);//底部蓝条
            //#else
//#            this.imgArray = new Image[9];
//#            //弹出层图片
//#            this.imgArray[0] = Tools.makeTransparent(ResManager.createImage(90000051), 255);
//#
//#            //背景颜色层
//#            this.imgArray[1] = Tools.makeTransparent(10, 91, 200, 0x989898);
//#            //游戏封面图片
            //#if NORMAL_240_400
//#             imgArray[2] = ResManager.createImage(90000017);
//#             imgArray[2] = Tools.ZoomImage(imgArray[2], Constant.DRAW_WIDTH, Constant.DRAW_HEIGHT);
            //#else
//#            this.imgArray[2] = ResManager.createImage(90000017);
            //#endif
//#            //蓝色的图片
//#            this.imgArray[3] = Tools.makeBlueMask();
//#            //箭头
//#            this.imgArray[4] = ResManager.createImage(90000041);
//#            //确定，取消
//#            this.imgArray[5] = ResManager.createImage(90000043);
//#            //版权图片
//#            this.imgArray[6] = ResManager.createImage(90000021);
//#            //登录，注册
//#            this.imgArray[7] = ResManager.createImage(90000025);
//#            //四个角落的阴影图片
//#//            this.imgArray[8] = Tools.createPicFromGrayscale(ResManager.createImage(90000019), -1);
            //#endif
            Rms.loadGame(Constant.RMS_LOGIN_USENAME_PASSWORD);
            this.sArray[0] = GameBean.STR_CMD_LOGIN_USENAME;
            this.sArray[1] = GameBean.STR_CMD_LOGIN_PASSWORD;
            if (sArray[0] == null || sArray[0].equals("")) {
                //#if NOKIA_S60V5
                 this.iPositionY = Constant.UI_START_Y + 310 + Constant.FONT_SMALL_HEIGHT;
                //#elif NOKIA_E72
//#                 this.iPositionY = Constant.UI_START_Y + 110 + 22 + Constant.FONT_SMALL_HEIGHT;
                //#else
//#                this.iPositionY = Constant.UI_START_Y + 244 + Constant.FONT_SMALL_HEIGHT;
                //#endif
                this.iSelectIndex = 2;
            } else if (sArray[1] == null || sArray[1].equals("")) {
                //#if NOKIA_S60V5
                 this.iPositionY = Constant.UI_START_Y + 340 + Constant.FONT_SMALL_HEIGHT;
                //#elif NOKIA_E72
//#                 this.iPositionY = Constant.UI_START_Y + 110 + 22 + Constant.FONT_SMALL_HEIGHT * 2;
                //#else
//#                this.iPositionY = Constant.UI_START_Y + 244 + Constant.FONT_SMALL_HEIGHT * 2;
                //#endif
                this.iSelectIndex = 3;
            } else {
                //#if NOKIA_S60V5
                 this.iPositionY = Constant.UI_START_Y + 288;
                //#elif NOKIA_E72
//#                 this.iPositionY = Constant.UI_START_Y + 110 + 22;
                //#else
//#                this.iPositionY = Constant.UI_START_Y + 244;
                //#endif
                this.iSelectIndex = 1;
            }

        } catch (Exception e) {
            if (Constant.DEBUG) {
                e.printStackTrace();
            }
            Tools.printLog("登录界面资源图片载入图片异常");
        }
    }

    /**
     * 更新登录界面createRole
     */
    public void updateLogin() {
        switch (this.byUiState) {
            case 0:
                if (this.iState == 0) {
                    this.lLastSysTime = System.currentTimeMillis();
                    this.iState = 1;
                    //是否显示闪屏
                    this.bFlag = false;
                } else if (this.iState == 1) {
                    if (System.currentTimeMillis() - this.lLastSysTime > 50) {
                        this.lLastSysTime = System.currentTimeMillis();
                        this.bFlag = true;
                        this.iState = 2;
                    }
                } else if (this.iState == 2) {
                    if (System.currentTimeMillis() - this.lLastSysTime > 50) {
                        this.lLastSysTime = System.currentTimeMillis();
                        this.iState = 0;
                        this.bFlag = false;
                        bUiKeyPressLock = false;
                        setGameUiState((byte) 1);
                    }
                }
                MainCanvas.clearInput();
                break;
            case 1:
                if (this.byPopState < 4) {
                    this.byPopState++;
                }
                if (!bUiKeyPressLock) {
                    if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_UP, false)) {
                        if (this.iSelectIndex > 1) {
                            this.iSelectIndex--;
                            //#if NOKIA_S60V5
                             switch (this.iSelectIndex) {
                                 case 1:
                                     this.iArray = new int[]{2, 1, Constant.UI_START_Y + 288, 2, 50, 3};
                                     break;
                                 case 2:
                                     this.iArray = new int[]{2, 1, Constant.UI_START_Y + 310 + Constant.FONT_SMALL_HEIGHT, 2, 50, 3};
                                     break;
                                 case 3:
                                     this.iArray = new int[]{2, 1, Constant.UI_START_Y + 340 + Constant.FONT_SMALL_HEIGHT, 2, 50, 3};
                                     break;
                             }
                            //#elif NOKIA_E72
//#                             switch (this.iSelectIndex) {
//#                                 case 1:
//#                                     this.iArray = new int[]{2, 1, Constant.UI_START_Y + 110 + 20, 2, 50, 3};
//#                                     break;
//#                                 case 2:
//#                                     this.iArray = new int[]{2, 1, Constant.UI_START_Y + 110 + 45, 2, 50, 3};
//#                                     break;
//#                                 case 3:
//#                                     this.iArray = new int[]{2, 1, Constant.UI_START_Y + 110 + 69, 2, 50, 3};
//#                                     break;
//#                             }
                            //#else
//#                            switch (this.iSelectIndex) {
//#                                case 1:
//#                                    this.iArray = new int[]{2, 1, Constant.UI_START_Y + 242, 2, 50, 3};
//#                                    break;
//#                                case 2:
//#                                    this.iArray = new int[]{2, 1, Constant.UI_START_Y + 267, 2, 50, 3};
//#                                    break;
//#                                case 3:
//#                                    this.iArray = new int[]{2, 1, Constant.UI_START_Y + 291, 2, 50, 3};
//#                                    break;
//#                            }
                            //#endif
                            this.bUiKeyPressLock = true;
                            this.iState = 4;
                        }
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_DOWN, false)) {
                        if (this.iSelectIndex < 3) {
                            this.iSelectIndex++;
                            //#if NOKIA_S60V5
                             switch (this.iSelectIndex) {
                                 case 1:
                                     this.iArray = new int[]{1, 1, Constant.UI_START_Y + 288, 2, 50, 3};
                                     break;
                                 case 2:
                                     this.iArray = new int[]{1, 1, Constant.UI_START_Y + 310 + Constant.FONT_SMALL_HEIGHT, 2, 50, 3};
                                     break;
                                 case 3:
                                     this.iArray = new int[]{1, 1, Constant.UI_START_Y + 340 + Constant.FONT_SMALL_HEIGHT, 2, 50, 3};
                                     break;
                             }
                            //#elif NOKIA_E72
//#                             switch (this.iSelectIndex) {
//#                                 case 1:
//#                                     this.iArray = new int[]{2, 1, Constant.UI_START_Y + 110 + 20, 2, 50, 3};
//#                                     break;
//#                                 case 2:
//#                                     this.iArray = new int[]{2, 1, Constant.UI_START_Y + 110 + 45, 2, 50, 3};
//#                                     break;
//#                                 case 3:
//#                                     this.iArray = new int[]{2, 1, Constant.UI_START_Y + 110 + 69, 2, 50, 3};
//#                                     break;
//#                             }
                            //#else
//#                            switch (this.iSelectIndex) {
//#                                case 1:
//#                                    this.iArray = new int[]{1, 1, Constant.UI_START_Y + 242, 2, 50, 3};
//#                                    break;
//#                                case 2:
//#                                    this.iArray = new int[]{1, 1, Constant.UI_START_Y + 267, 2, 50, 3};
//#                                    break;
//#                                case 3:
//#                                    this.iArray = new int[]{2, 1, Constant.UI_START_Y + 291, 2, 50, 3};
//#                                    break;
//#                            }
                            //#endif
                            this.bUiKeyPressLock = true;
                            this.iState = 5;
                        }
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_LEFT, false)) {
                        if (this.iSelectIndex == 1) {
                            if (this.iSubSelectIndex == 2) {
                                this.iSubSelectIndex = 1;
                            }
                        }
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_RIGHT, false)) {
                        if (this.iSelectIndex == 1) {
                            if (this.iSubSelectIndex == 1) {
                                this.iSubSelectIndex = 2;
                            }
                        }
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_POSITIVE, false)
                            || MainCanvas.keyPressedLogic(Constant.GAME_KEY_FIRE, false)
                            || MainCanvas.keyPressedLogic(Constant.GAME_KEY_5, false)) {
                        if (this.iSelectIndex == 1) {
                            if (this.iSubSelectIndex == 1) {
                                if (this.sArray[0].length() < Constant.MIN_USER_NAME_LENGTH || this.sArray[0].length() > Constant.MAX_USER_NAME_LENGTH || this.sArray[1].length() < Constant.MIN_USER_PASSWORD_LENGTH || this.sArray[1].length() > Constant.MAX_USER_PASSWORD_LENGTH) {
                                    UiInterFace.sysMessage.showMessage("提示", "用户名或是密码长度不正确", (byte) 1, (byte) -1, 0, -20);
                                } else {//用户登陆
                                    iState = 1;
                                    this.bUiKeyPressLock = true;
                                    Rms.loadGame(Constant.RMS_LOGIN_USENAME_PASSWORD);
                                    if (GameBean.STR_CMD_LOGIN_USENAME == null || !GameBean.STR_CMD_LOGIN_USENAME.equals(this.sArray[0])) {
                                        GameBean.BY_QUICK_ENTER = 0;
                                        Rms.saveGame(Constant.RMS_QUICK_STATUS, null);
                                    }
                                    GameBean.STR_CMD_LOGIN_USENAME = this.sArray[0];//"idtu4t5q";
                                    GameBean.STR_CMD_LOGIN_PASSWORD = this.sArray[1];//"Je6HR34x";
                                    Rms.saveGame(Constant.RMS_LOGIN_USENAME_PASSWORD, null);
//                                    Tools.printLog("GameBean.STR_CMD_LOGIN_USENAME  ::11 "+GameBean.STR_CMD_LOGIN_USENAME);
//                                    GameBean.STR_CMD_LOGIN_USENAME = "idtu4t5q";
//                                    GameBean.STR_CMD_LOGIN_PASSWORD = "Je6HR34x";
                                    this.byUiState = 4;

                                    //#if USER_CENTER=="TRUE"
                                    LocalMsgManager.getInstance().httpConnect(Constant.MSG_LOCAL_HTTP_LOGIN);
                                    //#else
//#                                     MainLogic.getInstance().send(Constant.MSG_NET_CMD_LOGIN, Constant.SOCKET_MSG_TYPE_LOGIC);
//#                                     MainLogic.getInstance().uiInterFace.byMaxLoadingNum = (byte) 90;
//#                                     MainLogic.getInstance().uiInterFace.setGameNextState(Constant.GAME_UI_CREATE_ROLE);
//#                                     MainLogic.pushState(Constant.GAME_UI_LOADING, false);
                                    //#endif
                                }
                            } else if (iSubSelectIndex == 2) {
                                MainLogic.getInstance().pushState(Constant.GAME_UI_OPTION_LIST, true);
                                MainLogic.inputInterFace.setInputInterFace(byUiState, "请输入用户名和密码");
                                MainGame.changeCanvas(MainLogic.getInstance().inputInterFace);
                            }
                        } else if (this.iSelectIndex == 2 || this.iSelectIndex == 3) {
                            this.setGameUiState((byte) 2);
                            MainLogic.inputInterFace.setInputInterFace(byUiState, "请输入登录用户名和密码");
                            MainGame.changeCanvas(MainLogic.getInstance().inputInterFace);
                        }
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_NEGATIVE, false)) {
                        MainLogic.getInstance().pushState(Constant.GAME_UI_OPTION_LIST, true);
                    }
                } else {
                    if (this.iState == 4 || this.iState == 5) {
                        this.iPositionY = Tools.updateLinePos(this.iArray, iPositionY);
                        if (this.iArray == null || this.iArray[1] == 0) {
                            this.bUiKeyPressLock = false;
                            this.iState = 0;
                        }
                        MainCanvas.clearInput();
                    }
                }
                break;
            case 2:
                break;
            case 4:
                if (this.byPopState > 0) {
                    this.byPopState--;
                }
//                else {
//                	bUiKeyPressLock = false;
//                	byUiState = 1;
//                }
//                if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_POSITIVE, false)
//            			||MainCanvas.keyPressedLogic(Constant.GAME_KEY_NEGATIVE, false)) {
//            		this.byUiState = 0;
//            	}
                break;
        }
        MainCanvas.clearInput();
    }

    /**
     * 绘制登录界面
     * @param g
     */
    public void drawLogin(Graphics g) {
        switch (byUiState) {
            case 0:
                //白色的闪屏
                if (bFlag) {
                    g.setColor(0xFFFFFF);
                    g.fillRect(Constant.UI_START_X, Constant.UI_START_Y, Constant.DRAW_WIDTH, Constant.DRAW_WIDTH);
                    return;
                }
                //游戏封面
                g.drawImage(imgArray[2], Constant.UI_START_X, Constant.UI_START_Y, Graphics.LEFT | Graphics.TOP);
                //版权图片
                g.drawImage(imgArray[6], Constant.UI_START_X + ((Constant.DRAW_WIDTH - 165) >> 1), Constant.UI_START_Y + 303, Graphics.LEFT | Graphics.TOP);
                //四个角落阴影图片
//                Tools.drawCorner(g, Constant.UI_START_X, Constant.UI_START_Y, imgArray[8]);
                break;
            case 1:
                //游戏封面
                //#if NOKIA_S60V5
//                 Tools.drawS60V5Frame(g, imgArray[2], imgArray[9], imgArray[10], imgArray[11], imgArray[5], null);
                 if (imgArray[2] != null) {
                     g.drawImage(imgArray[2], Constant.UI_START_X, Constant.UI_START_Y, Graphics.TOP | Graphics.LEFT);
                 }
//                 g.drawImage(imgArray[6], Constant.UI_START_X + ((Constant.DRAW_WIDTH - 165) >> 1), Constant.END_LINE - 17, Graphics.LEFT | Graphics.TOP);
                 Tools.drawPopUp(g, this.byPopState, Constant.UI_START_X + ((Constant.DRAW_WIDTH - 318) >> 1),
                         Constant.UI_START_Y + 265, 318, 120, this.imgArray[0], 0x9C9C9C,
                         null, 0, 0, 0, 0, null, 0, 0, 0, 0, null, null);
                 if (this.byPopState != 4) {
                     return;
                 }

                 if (iSelectIndex == 1) {
                     if (iSubSelectIndex == 1) {
                         g.drawRegion(this.imgArray[7], 0, 0, 26, 13, Constant.TRANS_NONE, Constant.UI_START_X + 100, Constant.UI_START_Y + 271, 0);
                         g.drawRegion(this.imgArray[7], 52, 13, 26, 13, Constant.TRANS_NONE, Constant.UI_START_X + 232, Constant.UI_START_Y + 271, 0);
                     } else {
                         g.drawRegion(this.imgArray[7], 0, 13, 26, 13, Constant.TRANS_NONE, Constant.UI_START_X + 100, Constant.UI_START_Y + 271, 0);
                         g.drawRegion(this.imgArray[7], 27, 13, 24, 13, Constant.TRANS_NONE, Constant.UI_START_X + 232, Constant.UI_START_Y + 271, 0);
                     }
                 } else {
                     g.drawRegion(this.imgArray[7], 0, 13, 26, 13, Constant.TRANS_NONE, Constant.UI_START_X + 100, Constant.UI_START_Y + 271, 0);
                     g.drawRegion(this.imgArray[7], 52, 13, 26, 13, Constant.TRANS_NONE, Constant.UI_START_X + 232, Constant.UI_START_Y + 271, 0);
                 }
                 //绘制用户名，密码;
                 startX = Constant.UI_START_X + 90;
                 startY = Constant.UI_START_Y + 307;
                 if (iSelectIndex == 2) {
                     //用户
                     Tools.drawShadowString(g, (byte) 1, this.sArray[2], startX, startY, 0x00CCFF, 0x333333);
                     if (this.sArray[0] != null && this.sArray[0].length() > 0) {
                         Tools.drawShadowString(g, (byte) 1, this.sArray[0], startX + Constant.FONT_SMALL.stringWidth(this.sArray[2]) + 4, startY, 0x00CCFF, 0x333333);
                     }
                     Tools.drawShadowString(g, (byte) 1, this.sArray[3], startX, startY + 30, 0xFFFFFF, 0x333333);
                     if (sArray[1] != null && this.sArray[1].length() > 0) {
                         StringBuffer startArray = new StringBuffer();
                         for (int i = 0; i < this.sArray[1].length(); i++) {
                             startArray.append("*");
                         }
                         Tools.drawShadowString(g, (byte) 1, startArray.toString(), startX + Constant.FONT_SMALL.stringWidth(this.sArray[3]), startY + 30, 0xFFFFFF, 0x333333);
                     }
                 } else if (iSelectIndex == 3) {
                     Tools.drawShadowString(g, (byte) 1, this.sArray[2], startX, startY, 0xFFFFFF, 0x333333);
                     if (sArray[0] != null && this.sArray[0].length() > 0) {
                         Tools.drawShadowString(g, (byte) 1, this.sArray[0], startX + Constant.FONT_SMALL.stringWidth(this.sArray[2]) + 4, startY, 0xFFFFFF, 0x333333);
                     }
                     Tools.drawShadowString(g, (byte) 1, this.sArray[3], startX, startY + 30, 0x00CCFF, 0x333333);
                     if (sArray[0] != null && this.sArray[1].length() > 0) {
                         StringBuffer startArray = new StringBuffer();
                         for (int i = 0; i < this.sArray[1].length(); i++) {
                             startArray.append("*");
                         }
                         Tools.drawShadowString(g, (byte) 1, startArray.toString(), startX + Constant.FONT_SMALL.stringWidth(this.sArray[3]), startY + 30, 0x00CCFF, 0x333333);
                     }
                 } else {
                     Tools.drawShadowString(g, (byte) 1, this.sArray[2], startX, startY, 0xFFFFFF, 0x333333);
                     if (sArray[0] != null && this.sArray[0].length() > 0) {
                         Tools.drawShadowString(g, (byte) 1, this.sArray[0], startX + Constant.FONT_SMALL.stringWidth(this.sArray[2]) + 4, startY, 0xFFFFFF, 0x333333);
                     }
                     Tools.drawShadowString(g, (byte) 1, this.sArray[3], startX, startY + 30, 0xFFFFFF, 0x333333);
                     if (sArray[1] != null && this.sArray[1].length() > 0) {
                         StringBuffer startArray = new StringBuffer();
                         for (int i = 0; i < this.sArray[1].length(); i++) {
                             startArray.append("*");
                         }
                         Tools.drawShadowString(g, (byte) 1, startArray.toString(), startX + Constant.FONT_SMALL.stringWidth(this.sArray[3]), startY + 30, 0xFFFFFF, 0x333333);
                     }
                 }

                //#else
//#                g.drawImage(imgArray[1], Constant.UI_START_X, Constant.UI_START_Y, Graphics.LEFT | Graphics.TOP);
//#                g.drawImage(imgArray[2], Constant.UI_START_X, Constant.UI_START_Y, Graphics.LEFT | Graphics.TOP);
//#                //版权图片
//#                g.drawImage(imgArray[6], Constant.UI_START_X + ((Constant.DRAW_WIDTH - 165) >> 1), Constant.DRAW_HEIGHT - 17, Graphics.LEFT | Graphics.TOP);
                //#if NOKIA_E72
//#                 Tools.drawPopUp(g, this.byPopState, Constant.UI_START_X + ((Constant.DRAW_WIDTH - 232) >> 1),
//#                         Constant.UI_START_Y + 107, 232, 80, this.imgArray[0], 0x9C9C9C,
//#                         null, 0, 0, 0, 0, null, 0, 0, 0, 0, null, null);
                //#else
//#                Tools.drawPopUp(g, this.byPopState, Constant.UI_START_X + ((Constant.DRAW_WIDTH - 232) >> 1),
//#                        Constant.UI_START_Y + 219, 232, 80, this.imgArray[0], 0x9C9C9C,
//#                        null, 0, 0, 0, 0, null, 0, 0, 0, 0, null, null);
                //#endif
//#                if (this.byPopState != 4) {
//#                    return;
//#                }
//#                //登陆 注册
//#                startX = Constant.UI_START_X + (Constant.DRAW_WIDTH - 232 >> 1) + ((232 >> 1) - 26 >> 1);
                //#if NOKIA_E72
//#                 startY = 110;
                //#else
//#                startY = 222;
                //#endif
//#                if (iSelectIndex == 1) {
//#                    if (iSubSelectIndex == 1) {
//#                        g.drawRegion(this.imgArray[7], 0, 0, 26, 13, Constant.TRANS_NONE, startX, startY, 0);
//#                        g.drawRegion(this.imgArray[7], 52, 13, 26, 13, Constant.TRANS_NONE, startX + (232 >> 1), startY, 0);
//#                    } else {
//#                        g.drawRegion(this.imgArray[7], 0, 13, 26, 13, Constant.TRANS_NONE, startX, startY, 0);
//#                        g.drawRegion(this.imgArray[7], 27, 13, 24, 13, Constant.TRANS_NONE, startX + (232 >> 1), startY, 0);
//#                    }
//#                } else {
//#                    g.drawRegion(this.imgArray[7], 0, 13, 26, 13, Constant.TRANS_NONE, startX, startY, 0);
//#                    g.drawRegion(this.imgArray[7], 52, 13, 26, 13, Constant.TRANS_NONE, startX + (232 >> 1), startY, 0);
//#                }
//#                //绘制用户名，密码;
//#                if (iSelectIndex == 2) {
//#                    //用户
//#                    Tools.drawShadowString(g, (byte) 1, this.sArray[2], startX, startY + 21, 0x00CCFF, 0x333333);
//#                    if (sArray[0] != null && this.sArray[0].length() > 0) {
//#                        Tools.drawShadowString(g, (byte) 1, this.sArray[0], startX + Constant.FONT_SMALL.stringWidth(this.sArray[2]) + 4, startY + 21, 0x00CCFF, 0x333333);
//#                    }
//#                    Tools.drawShadowString(g, (byte) 1, this.sArray[3], startX, startY + 47, 0xFFFFFF, 0x333333);
//#                    if (sArray[1] != null && this.sArray[1].length() > 0) {
//#                        StringBuffer startArray = new StringBuffer();
//#                        for (int i = 0; i < this.sArray[1].length(); i++) {
//#                            startArray.append("*");
//#                        }
//#                        Tools.drawShadowString(g, (byte) 1, startArray.toString(), startX + Constant.FONT_SMALL.stringWidth(this.sArray[3]), startY + 47, 0xFFFFFF, 0x333333);
//#                    }
//#                } else if (iSelectIndex == 3) {
//#                    Tools.drawShadowString(g, (byte) 1, this.sArray[2], startX, startY + 21, 0xFFFFFF, 0x333333);
//#                    if (sArray[0] != null && this.sArray[0].length() > 0) {
//#                        Tools.drawShadowString(g, (byte) 1, this.sArray[0], startX + Constant.FONT_SMALL.stringWidth(this.sArray[2]) + 4, startY + 21, 0xFFFFFF, 0x333333);
//#                    }
//#                    Tools.drawShadowString(g, (byte) 1, this.sArray[3], startX, startY + 47, 0x00CCFF, 0x333333);
//#                    if (sArray[1] != null && this.sArray[1].length() > 0) {
//#                        StringBuffer startArray = new StringBuffer();
//#                        for (int i = 0; i < this.sArray[1].length(); i++) {
//#                            startArray.append("*");
//#                        }
//#                        Tools.drawShadowString(g, (byte) 1, startArray.toString(), startX + Constant.FONT_SMALL.stringWidth(this.sArray[3]), startY + 47, 0x00CCFF, 0x333333);
//#                    }
//#                } else {
//#                    Tools.drawShadowString(g, (byte) 1, this.sArray[2], startX, startY + 21, 0xFFFFFF, 0x333333);
//#                    if (sArray[0] != null && this.sArray[0].length() > 0) {
//#                        Tools.drawShadowString(g, (byte) 1, this.sArray[0], startX + Constant.FONT_SMALL.stringWidth(this.sArray[2]) + 4, startY + 21, 0xFFFFFF, 0x333333);
//#                    }
//#                    Tools.drawShadowString(g, (byte) 1, this.sArray[3], startX, startY + 47, 0xFFFFFF, 0x333333);
//#                    if (sArray[1] != null && this.sArray[1].length() > 0) {
//#                        StringBuffer startArray = new StringBuffer();
//#                        for (int i = 0; i < this.sArray[1].length(); i++) {
//#                            startArray.append("*");
//#                        }
//#                        Tools.drawShadowString(g, (byte) 1, startArray.toString(), startX + Constant.FONT_SMALL.stringWidth(this.sArray[3]), startY + 47, 0xFFFFFF, 0x333333);
//#                    }
//#                }
                //#endif
                //绘制确定和取消线横线
                Tools.drawSelectMask(g, (byte) 1, imgArray[3], Constant.UI_START_X, iPositionY, Constant.DRAW_WIDTH, imgArray[4], null, 0, 0, 0, 0, null, 0, 0, 0, 0);
                MainView.drawTouchRect(g, mlogin);
                break;
            case 4:
                //游戏封面
                g.drawImage(imgArray[2], Constant.UI_START_X, Constant.UI_START_Y, Graphics.LEFT | Graphics.TOP);
                //版权图片
//                System.out.println("cccccccc   "+imgArray.length);
                g.drawImage(imgArray[6], Constant.UI_START_X + ((Constant.DRAW_WIDTH - 165) >> 1), 303, Graphics.LEFT | Graphics.TOP);
                //四个角落阴影图片
//                Tools.drawCorner(g, Constant.UI_START_X, Constant.UI_START_Y, imgArray[8]);
                if (this.byPopState > 0) {
                    //#if NOKIA_S60V5
                     Tools.drawPopUp(g, this.byPopState, Constant.UI_START_X + ((Constant.DRAW_WIDTH - 318) >> 1),
                             Constant.UI_START_Y + 265, 318, 120, this.imgArray[0], 0x9C9C9C,
                             null, 0, 0, 0, 0, null, 0, 0, 0, 0, null, null);
                    //#else
//#                    Tools.drawPopUp(g, this.byPopState, Constant.UI_START_X + ((Constant.DRAW_WIDTH - 232) >> 1),
//#                            Constant.UI_START_Y + 219, 232, 80, this.imgArray[0], 0x9C9C9C,
//#                            null, 0, 0, 0, 0, null, 0, 0, 0, 0, null, null);
                    //#endif
                }
                break;
        }
    }
    private static int[][] mlogin;
    public void checkTouchLogin(int x, int y) {
        switch (byUiState) {
        case 0:
        	break;
        case 1:
            if (this.byPopState < 4) {
                this.byPopState++;
            }
            if (!bUiKeyPressLock) {
	        	if (mlogin == null) {
	        		mlogin = new int[][]{
	        				{21,264,318,28},
	        				{21,264+28,318,39},
	        				{21,264+28+39,318,39},
	        		};
	        	}
	        	int touched = MainCanvas.checkTouch(x, y, mlogin);
	        	if (touched >= 0) {
	        		switch(touched) {
	        		case 0:
	        			if (x < 180) {
//	        				if (this.iSelectIndex == 1 && this.iSubSelectIndex == 1) {
	        					this.iSelectIndex = 1;
		        				this.iSubSelectIndex = 1;
	        					MainCanvas.pressFire();
//	        				} else {
//		        				this.iSelectIndex = 1;
//		        				this.iSubSelectIndex = 1;
//	        				}
	        			} else {
//	        				if (this.iSelectIndex == 1 && this.iSubSelectIndex == 2) {
	        					this.iSelectIndex = 1;
		        				this.iSubSelectIndex = 2;
	        					MainCanvas.pressFire();
//	        				} else {
//		        				this.iSelectIndex = 1;
//		        				this.iSubSelectIndex = 2;
//	        				}
	        			}
	        			break;
	        		case 1:
	        			if (iSelectIndex == 2) {
	        				MainCanvas.pressFire();
	        			} else {
		        			this.iSelectIndex = 2;
//		        			this.bUiKeyPressLock = true;
	        			}
	        			break;
	        		case 2:
	        			if (this.iSelectIndex == 3) {
	        				MainCanvas.pressFire();
	        			} else {
	        				this.iSelectIndex = 3;
//	        				this.bUiKeyPressLock = true;
	        			}
	        			break;
	        		}
	        	} else {
	        		MainCanvas.pressBack();
	        	}
            }
        	break;
        case 4:
        	MainCanvas.checkSoftKey();
        	break;
        }
//        MainCanvas.checkSoftKey();
    }

    /**
     * 清除登录界面的资源
     */
    public void clearLogin() {
        imgArray = null;
        iSelectIndex = 1;
        imgArray = null;
        sArray = null;
        bFlag = false;
        bUiKeyPressLock = false;
        this.iLineConfigArray = null;
        this.sStrArray = null;
    }

    /**
     * 初始化创建角色额
     */
    public void initCreateRole() {
        //弹出层配置和资源
        MainCanvas.clearInput();
        byUiState = 0;
        this.iState = 0;
        //性别
        GameBean.BY_CMD_PLAYER_SEX = Constant.PLAYER_SEX_WOMAN;
        //职业
        GameBean.BY_CMD_PLAYER_JOB = Constant.PLAYER_OCCUPTION_ASSASSIN;
        //角色名称
        GameBean.STR_CMD_PLAYER_NICK = "";
        this.bFlag = true;
        this.iState = 0;
        this.iSelectIndex = 1;
        this.bySelectIndex = 1;
        //#if NOKIA_S60V5
         this.iPositionY = 41 + (bySelectIndex) * (Constant.FONT_SMALL.getHeight() * 3 + 8 + (Constant.NEW_END_LINE - 41 - (Constant.FONT_SMALL.getHeight() * 3 + 8) * 4) / 5);
        //#else
//#        this.iPositionY = Constant.UI_START_Y + 20 + (bySelectIndex) * 68;
        //#endif
        this.bUiKeyPressLock = true;
        this.animation = new Player[6];
        iMenuArray = new int[]{0, 1, 2};
        GameBean.b_WAIT_NET_MSG_BACK = false;
        this.byPopState = 1;
        sArray = new String[]{"角色列表", "角色：", "等级：", "位置：", "创建角色"};
        sStrArray = new String[]{"天生的战士 具有超", "强的生命力和防御力",
            "敏锐的猎手 通过战斗", "控制和爆发力击败对手",
            "自然的掌控者 具有超", "高的攻击力和辅助能力"};
        //存储角色信息用
        try {
            //#if NOKIA_S60V5
             //图片资源
             imgArray = new Image[14];
             imgArray[0] = Tools.createPicFromGrayscale(ResManager.createImage(90000019), -1);//ui图片
             imgArray[1] = ResManager.createImage(90000017);//游戏封面图片
             imgArray[2] = ResManager.createImage(90000025);//新的冒险背景图片
 //            imgArray[3] = Tools.makeTransparent(10, 58, 255, 0x9c9c9c);
             imgArray[4] = ResManager.createImage(90000041);//箭头
             imgArray[5] = Tools.makeTransparent(ResManager.createImage(90000051), 255);//弹出层边框图片
             imgArray[6] = ResManager.createImage(90000043);//确定
             imgArray[7] = Tools.createPicFromGrayscale(ResManager.createImage(90000046), 0xFFFFFF); //光柱图片
             imgArray[8] = Tools.makeBlueMask();//蓝色遮罩
             //阴影
 //            this.imgArray[9] = Tools.makeTransparent(ResManager.createImage(90000072), 70);
             //弹出层配置
 //            imgArray[10] = Tools.makeTransparent(10, 115, 255, 0x9c9c9c);//弹出城背景颜色层
             imgArray[11] = ResManager.createImage(90000084);//方向键
             imgArray[12] = ResManager.createImage(90000085);//确定键
             imgArray[13] = ResManager.createImage(90000086);//底部蓝条
             iPositionY = Constant.UI_START_Y + Constant.END_LINE - 90;
            //#else
//#            //图片资源
//#            this.imgArray = new Image[11];
//#            //ui图片
//#            this.imgArray[0] = Tools.createPicFromGrayscale(ResManager.createImage(90000019), -1);
//#            //游戏封面图片
            //#if NORMAL_240_400
//#             imgArray[1] = ResManager.createImage(90000017);
//#             imgArray[1] = Tools.ZoomImage(imgArray[1], Constant.DRAW_WIDTH, Constant.DRAW_HEIGHT);
            //#else
//#            this.imgArray[1] = ResManager.createImage(90000017);
            //#endif
//#            //新的冒险背景图片
//#            this.imgArray[2] = ResManager.createImage(90000025);
//#            //版权图片
//#            this.imgArray[3] = Tools.makeTransparent(10, 58, 255, 0x9c9c9c);
//#            //箭头
//#            this.imgArray[4] = ResManager.createImage(90000041);
//#            //弹出层边框图片
//#            this.imgArray[5] = Tools.makeTransparent(ResManager.createImage(90000051), 255);
//#            //确定
//#            this.imgArray[6] = ResManager.createImage(90000043);
//#            //光柱图片
//#            this.imgArray[7] = Tools.createPicFromGrayscale(ResManager.createImage(90000046), 0xFFFFFF);
//#            //蓝色遮罩
//#            this.imgArray[8] = Tools.makeBlueMask();
//#            //阴影
//#//            this.imgArray[9] = Tools.makeTransparent(ResManager.createImage(90000072), 70);
//#            //弹出层配置
//#            this.iPositionY = Constant.UI_START_Y + Constant.DRAW_HEIGHT - 137 + 39;
//#            //弹出城背景颜色层
//#            this.imgArray[10] = Tools.makeTransparent(10, 115, 255, 0x9c9c9c);
            //#endif
            //计数和状态数组
            this.iArray = new int[]{0, 0, 0, 0, 0, 0, 0, 0};
            changeSelectRole((byte) -1, (byte) -1, Constant.PLAYER_SEX_WOMAN, true, true, (byte) -1);
            this.iArray[3] = this.animation[0].iPlayerX - this.imgArray[7].getWidth();
            selectNum = 4;
            if (sDataArray == null) {
                this.setGameUiState((byte) 1);
            } else {
                changeSelectRole((byte) 1, (byte) -1, Constant.PLAYER_SEX_WOMAN, true, true, (byte) -1);
                //#if NOKIA_S60V5
                 int start_Y = 41;
                 int rect_H = Constant.FONT_SMALL.getHeight() * 3 + 8;
                 int rect_Y = (Constant.NEW_END_LINE - start_Y - rect_H * 4) / 5;
                 iArray = new int[]{2, 1, start_Y + (bySelectIndex) * (rect_H + rect_Y), 2, 50, 5};
                //#else
//#                iArray = new int[]{2, 1, Constant.UI_START_Y + 20 + (bySelectIndex) * 68, 2, 50, 5};
                //#endif
            }
        } catch (Exception e) {
            if (Constant.DEBUG) {
                e.printStackTrace();
            }
            Tools.printLog("创建角色界面初始化载入图片异常");
        }
        //#if NOKIA_E72
//#         Tools.initE72ScollBar();
        //#endif
        Tools.printLog("创建角色");
    }

    /**
     * 更新创建角色界面
     */
    public void updateCreateRole() {
        switch (byUiState) {
            case 0:
                if (!bUiKeyPressLock) {
                    if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_UP, false)) {
                        if (bySelectIndex > 1) {
                            bySelectIndex--;
                            //#if NOKIA_S60V5
                             int start_Y = 41;
                             int rect_H = Constant.FONT_SMALL.getHeight() * 3 + 8;
                             int rect_Y = (Constant.NEW_END_LINE - start_Y - rect_H * 4) / 5;
                             iArray = new int[]{2, 1, start_Y + (bySelectIndex) * (rect_H + rect_Y), 2, 50, 5};
                            //#else
                            //#if NOKIA_E72
//#                             Tools.updateE72ScollBar(((bySelectIndex - 1) * (-27)));
                            //#endif
//#                            iArray = new int[]{2, 1, Constant.UI_START_Y + 20 + (bySelectIndex) * 68 + UiInterFace.iScreenOffsetH, 2, 50, 5};
                            //#endif
                            bUiKeyPressLock = true;
                        }
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_DOWN, false)) {
                        if (bySelectIndex < selectNum) {
                            bySelectIndex++;
                            //#if NOKIA_S60V5
                             int start_Y = 41;
                             int rect_H = Constant.FONT_SMALL.getHeight() * 3 + 8;
                             int rect_Y = (Constant.NEW_END_LINE - start_Y - rect_H * 4) / 5;
                             iArray = new int[]{2, 1, start_Y + (bySelectIndex) * (rect_H + rect_Y), 2, 50, 5};
                            //#else
                            //#if NOKIA_E72
//#                             Tools.updateE72ScollBar(((bySelectIndex - 1) * (-27)));
                            //#endif
//#                            iArray = new int[]{2, 1, Constant.UI_START_Y + 20 + (bySelectIndex) * 68 + UiInterFace.iScreenOffsetH, 2, 50, 5};
                            //#endif
                            bUiKeyPressLock = true;
                        }
                    }
//                    Tools.printLog("bySelectIndex ::: " + sDataArray.length);
                    if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_POSITIVE, false)
                            || MainCanvas.keyPressedLogic(Constant.GAME_KEY_FIRE, false)
                            || MainCanvas.keyPressedLogic(Constant.GAME_KEY_5, false)) {
                        if (bySelectIndex <= (sDataArray.length) / 6) {
                            Constant.PLAYER_INDEX = (byte) bySelectIndex;
                            Tools.printLog("Constant.PLAYER_INDEX111   :::  " + Constant.PLAYER_INDEX);
                            switch (Constant.PLAYER_INDEX) {
                                case 1:
                                    Rms.loadGame(Constant.RMS_NEW_PLAYER_TUITION_1);
//                                    System.out.println("111 :: " + MainLogic.getInstance().uiInterFace.sysMessage.saveStateGuide);
                                    Rms.saveGame(Constant.RMS_NEW_PLAYER_TUITION_1, null);
                                    break;
                                case 2:
                                    Rms.loadGame(Constant.RMS_NEW_PLAYER_TUITION_2);
//                                    System.out.println("222 :: " + MainLogic.getInstance().uiInterFace.sysMessage.saveStateGuide);
                                    Rms.saveGame(Constant.RMS_NEW_PLAYER_TUITION_2, null);
                                    break;
                                case 3:
                                    Rms.loadGame(Constant.RMS_NEW_PLAYER_TUITION_3);
//                                    System.out.println("333 :: " + MainLogic.getInstance().uiInterFace.sysMessage.saveStateGuide);
                                    Rms.saveGame(Constant.RMS_NEW_PLAYER_TUITION_3, null);
                                    break;
                                case 4:
                                    Rms.loadGame(Constant.RMS_NEW_PLAYER_TUITION_4);
//                                    System.out.println("444 :: " + MainLogic.getInstance().uiInterFace.sysMessage.saveStateGuide);
                                    Rms.saveGame(Constant.RMS_NEW_PLAYER_TUITION_4, null);
                                    break;
                            }
                            GameBean.L_CMD_PLAYER_OWN_ID = Long.parseLong(sDataArray[(bySelectIndex - 1) * 6]);
                            Rms.saveGame(Constant.RMS_PLAYER_INDEX, null);
                            Rms.saveGame(Constant.RMS_PLAYER_ID, null);
                            if (sDataArray[(bySelectIndex - 1) * 6 + 1] != null) {
                                GameBean.L_CMD_PLAYER_OWN_LEVLE = Integer.parseInt(sDataArray[(bySelectIndex - 1) * 6 + 1]);
                            }
                            GameBean.L_CMD_PLAYER_OWN_SEX = Byte.parseByte(sDataArray[(bySelectIndex - 1) * 6 + 4]);
                            Rms.saveGame(Constant.RMS_PLAYER_LEVLE, null);
                            Rms.saveGame(Constant.RMS_PLAYER_SEX, null);
//                            Rms.saveGame(Constant.RMS_C, data)

//                            System.out.println(" GameBean.L_CMD_PLAYER_OWN_LEVLE  :::  " + GameBean.L_CMD_PLAYER_OWN_LEVLE);
//                            System.out.println(" GameBean.L_CMD_PLAYER_OWN_SEX  :::  " + GameBean.L_CMD_PLAYER_OWN_SEX);
                            //发送登入游戏消息指令
                            MainLogic.getInstance().send(Constant.MSG_NET_ENTER_WORLD, Constant.SOCKET_MSG_TYPE_LOGIC);
                            MainLogic.getInstance().uiInterFace.setGameNextState(Constant.GAME_UI_ROAM);
                            UiInterFace.byMaxLoadingNum = (byte) 65;
                            MainLogic.pushState(Constant.GAME_UI_LOADING, false);
                            //Tools.printLog("有角色登录"+ GameBean.L_CMD_PLAYER_OWN_LEVLE+"id"+sDataArray[Constant.PLAYER_INDEX * 6 + 1]);
                        } else {
                            this.iArray = new int[]{0, 0, 0, 0, 0, 0, 0, Constant.UI_START_Y + ((Constant.DRAW_HEIGHT - 42 - this.imgArray[1].getHeight()) >> 1)};
                            //#if NOKIA_S60V5
                             iPositionY = Constant.UI_START_Y + Constant.END_LINE - 90;
                            //#else
//#                            this.iPositionY = Constant.UI_START_Y + Constant.DRAW_HEIGHT - 137 + 39;
                            //#endif
                            changeSelectRole((byte) -1, (byte) -1, Constant.PLAYER_SEX_WOMAN, true, true, (byte) -1);
                            this.iArray[3] = this.animation[0].iPlayerX - this.imgArray[7].getWidth();
                            this.setGameUiState((byte) 1);
                        }
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_NEGATIVE, false)) {
                        MainLogic.getInstance().exitGame();
                    }
                } else {
                    iPositionY = Tools.updateLinePos(iArray, iPositionY);
                    if (iArray == null || iArray[1] == 0) {
                        bUiKeyPressLock = false;
                    }
                }
                break;
            case 1:
                //更改背景遮罩状态
                if (this.iState < 3) {
                    this.iState++;
                } else {
                    this.bUiKeyPressLock = true;
                    this.iState = 0;
                    this.setGameUiState((byte) 2);
                }
                break;
            case 2:
                if (!GameBean.b_WAIT_NET_MSG_BACK) {
                    //弹出层状态更改
                    if (this.byPopState < 4) {
                        this.byPopState++;
                        if (byPopState == 4) {
                            this.bUiKeyPressLock = false;
                        }
                    }
                    //
                    //确定和取消的箭头动画效果
                    bFlag = bFlag ? false : true;
                    if (!bUiKeyPressLock) {
                        if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_NEGATIVE, false)) {
                            MainLogic.getInstance().exitGame();
                        } else if (this.iSelectIndex == 3 && (MainCanvas.keyPressedLogic(Constant.GAME_KEY_POSITIVE, false) || MainCanvas.keyPressedLogic(Constant.GAME_KEY_FIRE, false) || MainCanvas.keyPressedLogic(Constant.GAME_KEY_5, false))) {
                            //转入高级界面输入用角色名称
                            setGameUiState((byte) 4);
                            MainLogic.getInstance().inputInterFace.setInputInterFace(this.byUiState, "请输入角色名称");
                            MainLogic.inputInterFace.commonInput.setString(GameBean.STR_CMD_PLAYER_NICK);
                            MainGame.changeCanvas(MainLogic.getInstance().inputInterFace);
                        } else if (this.iSelectIndex == 2 && MainCanvas.keyPressedLogic(Constant.GAME_KEY_RIGHT, false)) {
                            GameBean.BY_CMD_PLAYER_SEX = (GameBean.BY_CMD_PLAYER_SEX == Constant.PLAYER_SEX_MAN) ? Constant.PLAYER_SEX_WOMAN : Constant.PLAYER_SEX_MAN;
                            if (GameBean.BY_CMD_PLAYER_SEX == Constant.PLAYER_SEX_MAN) {
                                changeSelectRole((byte) -1, (byte) -1, Constant.PLAYER_SEX_MAN, true, true, (byte) -1);
                            } else {
                                changeSelectRole((byte) -1, (byte) -1, Constant.PLAYER_SEX_WOMAN, true, true, (byte) -1);
                            }
                        } else if (this.iSelectIndex == 2 && MainCanvas.keyPressedLogic(Constant.GAME_KEY_LEFT, false)) {
                            GameBean.BY_CMD_PLAYER_SEX = (GameBean.BY_CMD_PLAYER_SEX == Constant.PLAYER_SEX_MAN) ? Constant.PLAYER_SEX_WOMAN : Constant.PLAYER_SEX_MAN;
                            if (GameBean.BY_CMD_PLAYER_SEX == Constant.PLAYER_SEX_MAN) {
                                changeSelectRole((byte) -1, (byte) -1, Constant.PLAYER_SEX_MAN, true, true, (byte) -1);
                            } else {
                                changeSelectRole((byte) -1, (byte) -1, Constant.PLAYER_SEX_WOMAN, true, true, (byte) -1);
                            }
                        } else if (this.iSelectIndex == 1 && MainCanvas.keyPressedLogic(Constant.GAME_KEY_RIGHT, false)) {
                            switch (GameBean.BY_CMD_PLAYER_JOB) {
                                case Constant.PLAYER_OCCUPTION_ASSASSIN:
                                    GameBean.BY_CMD_PLAYER_JOB = Constant.PLAYER_OCCUPTION_SWORD;
                                    break;
                                case Constant.PLAYER_OCCUPTION_MASTER:
                                    GameBean.BY_CMD_PLAYER_JOB = Constant.PLAYER_OCCUPTION_ASSASSIN;
                                    break;
                                case Constant.PLAYER_OCCUPTION_SWORD:
                                    GameBean.BY_CMD_PLAYER_JOB = Constant.PLAYER_OCCUPTION_MASTER;
                                    break;
                            }
                            changeSelectRole((byte) -1, (byte) -1, Constant.PLAYER_SEX_MAN, false, true, (byte) 1);
                        } else if (this.iSelectIndex == 1 && MainCanvas.keyPressedLogic(Constant.GAME_KEY_LEFT, false)) {
                            switch (GameBean.BY_CMD_PLAYER_JOB) {
                                case Constant.PLAYER_OCCUPTION_ASSASSIN:
                                    GameBean.BY_CMD_PLAYER_JOB = Constant.PLAYER_OCCUPTION_MASTER;
                                    break;
                                case Constant.PLAYER_OCCUPTION_MASTER:
                                    GameBean.BY_CMD_PLAYER_JOB = Constant.PLAYER_OCCUPTION_SWORD;
                                    break;
                                case Constant.PLAYER_OCCUPTION_SWORD:
                                    GameBean.BY_CMD_PLAYER_JOB = Constant.PLAYER_OCCUPTION_ASSASSIN;
                                    break;
                            }
                            changeSelectRole((byte) -1, (byte) -1, Constant.PLAYER_SEX_MAN, false, true, (byte) 0);
                        } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_UP, false)) {
                            if (iSelectIndex != 1) {
                                this.iSelectIndex = this.iSelectIndex - 1;
                                //#if NOKIA_S60V5
                                 iLineConfigArray = new int[]{2, 1, Constant.UI_START_Y + Constant.END_LINE - 110 + iSelectIndex * 20, 2, 10, 5};
                                //#else
//#                                this.iLineConfigArray = new int[]{2, 1, Constant.UI_START_Y + Constant.DRAW_HEIGHT - 137 + 39 + (iSelectIndex - 1) * 20, 2, 10, 5};
                                //#endif
                                this.bUiKeyPressLock = true;
                                this.iState = 3;
                            }
                        } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_DOWN, false)) {
                            if (iSelectIndex != 4) {
                                iSelectIndex = iSelectIndex + 1;
                                //#if NOKIA_S60V5
                                 iLineConfigArray = new int[]{1, 1, Constant.UI_START_Y + Constant.END_LINE - 110 + iSelectIndex * 20, 2, 10, 5};
                                //#else
//#                                this.iLineConfigArray = new int[]{1, 1, Constant.UI_START_Y + Constant.DRAW_HEIGHT - 137 + 39 + (iSelectIndex - 1) * 20, 2, 10, 5};
                                //#endif
                                this.bUiKeyPressLock = true;
                                this.iState = 4;
                            }
                        } else if (iSelectIndex == 4 && (MainCanvas.keyPressedLogic(Constant.GAME_KEY_POSITIVE, false) || MainCanvas.keyPressedLogic(Constant.GAME_KEY_FIRE, false) || MainCanvas.keyPressedLogic(Constant.GAME_KEY_5, false))) {
                            //判断用户是否输入了角色名称和角色名称的长度
                            if (GameBean.STR_CMD_PLAYER_NICK.length() < 1) {
                                UiInterFace.sysMessage.showMessage("提示", "姓名不可以为空", (byte) 1, (byte) -1, 0, -20);
                            } else {
                                this.iState = 3;
                                this.setGameUiState((byte) 3);
                            }
                        }
                    } else {
                        if (this.iState == 3 || this.iState == 4) {
                            //实现线的上下抖动
                            this.iPositionY = Tools.updateLinePos(this.iLineConfigArray, this.iPositionY);
                            if (this.iLineConfigArray == null || this.iLineConfigArray[1] == 0) {
                                this.iState = 0;
                                this.bUiKeyPressLock = false;
                            }
                        } else if (this.iState == 1 || this.iState == 2) {
                            //选择男女时候光柱帧计数,光柱左右移动
                            if (this.iSelectIndex == 2) {
                                if (this.iArray[2] == 1) {
                                    if (this.iArray[3] - 20 <= this.animation[1].iPlayerX - this.imgArray[7].getWidth()) {
                                        this.iArray[3] = this.animation[1].iPlayerX - this.imgArray[7].getWidth();
                                        this.iArray[2] = 0;
                                        this.iState = 0;
                                        this.bUiKeyPressLock = false;
                                    } else {
                                        this.iArray[3] -= 20;
                                    }
                                } else if (this.iArray[2] == 2) {
                                    if (this.iArray[3] + 20 >= this.animation[0].iPlayerX - this.imgArray[7].getWidth()) {
                                        this.iArray[3] = this.animation[0].iPlayerX - this.imgArray[7].getWidth();
                                        this.iArray[2] = 0;
                                        this.iState = 0;
                                        this.bUiKeyPressLock = false;
                                    } else {
                                        this.iArray[3] += 20;
                                    }
                                }
                            } else if (this.iSelectIndex == 3) {
                                if (System.currentTimeMillis() - this.lLastSysTime > 500) {
                                    this.iState = 0;
                                    this.bUiKeyPressLock = false;
                                }
                            }
                        } else {
                            this.iState = 0;
                            this.bUiKeyPressLock = false;
                        }
                        MainCanvas.clearInput();
                    }
                }
                break;
            case 3:
                if (this.iState > 0) {
                    this.iState--;
                } else {
                    this.bUiKeyPressLock = true;
                    //UiInterFace.setGameNextState(Constant.GAME_UI_OPEN_SCREEN);

//                    hh
                    if (sDataArray != null) {
                        if ((byte) bySelectIndex > (sDataArray.length / 6)) {
                            Constant.PLAYER_INDEX = (byte) (sDataArray.length / 6 + 1);
                        }
                    }
                    Tools.printLog("Constant.PLAYER_INDEX222   :::  " + Constant.PLAYER_INDEX);
                    switch (Constant.PLAYER_INDEX) {
                        case 1:
//                            Rms.loadGame(Constant.RMS_NEW_PLAYER_TUITION_1);
                            MainLogic.getInstance().uiInterFace.sysMessage.saveStateGuide = -1;
//                            System.out.println("111 :: " + MainLogic.getInstance().uiInterFace.sysMessage.saveStateGuide);
                            Rms.saveGame(Constant.RMS_NEW_PLAYER_TUITION_1, null);
                            break;
                        case 2:
//                            Rms.loadGame(Constant.RMS_NEW_PLAYER_TUITION_2);
                            MainLogic.getInstance().uiInterFace.sysMessage.saveStateGuide = -1;
//                            System.out.println("222 :: " + MainLogic.getInstance().uiInterFace.sysMessage.saveStateGuide);
                            Rms.saveGame(Constant.RMS_NEW_PLAYER_TUITION_2, null);
                            break;
                        case 3:
//                            Rms.loadGame(Constant.RMS_NEW_PLAYER_TUITION_3);
                            MainLogic.getInstance().uiInterFace.sysMessage.saveStateGuide = -1;
//                            System.out.println("333 :: " + MainLogic.getInstance().uiInterFace.sysMessage.saveStateGuide);
                            Rms.saveGame(Constant.RMS_NEW_PLAYER_TUITION_3, null);
                            break;
                        case 4:
//                            Rms.loadGame(Constant.RMS_NEW_PLAYER_TUITION_4);
                            MainLogic.getInstance().uiInterFace.sysMessage.saveStateGuide = -1;
//                            System.out.println("444 :: " + MainLogic.getInstance().uiInterFace.sysMessage.saveStateGuide);
                            Rms.saveGame(Constant.RMS_NEW_PLAYER_TUITION_4, null);
                            break;
                    }
                    GameBean.L_CMD_PLAYER_OWN_LEVLE = 1;
                    //性别
                    GameBean.L_CMD_PLAYER_OWN_SEX = GameBean.BY_CMD_PLAYER_SEX;
                    //职业
                    MainLogic.getInstance().pushState(Constant.GAME_UI_LOADING, true);
                    MainLogic.getInstance().send(Constant.MSG_NET_CREATE_ROLE, Constant.SOCKET_MSG_TYPE_LOGIC);
                    MainLogic.getInstance().uiInterFace.setGameNextState(Constant.GAME_UI_ROAM);
                    UiInterFace.byMaxLoadingNum = (byte) 65;
                    Rms.saveGame(Constant.RMS_PLAYER_INDEX, null);
                    Rms.saveGame(Constant.RMS_PLAYER_LEVLE, null);
                    Rms.saveGame(Constant.RMS_PLAYER_SEX, null);
//                    System.out.println(" GameBean.L_CMD_PLAYER_OWN_LEVLE 22 :::  " + GameBean.L_CMD_PLAYER_OWN_LEVLE);
//                    System.out.println(" GameBean.L_CMD_PLAYER_OWN_SEX  22 :::  " + GameBean.L_CMD_PLAYER_OWN_SEX);
                }
                break;
            case 4:
                //获取输入的内容
                break;
        }
    }

    /**
     * 绘制角色创建界面
     * @param g
     */
    public void drawCreateRole(Graphics g) {
        //游戏封面
        //#if NOKIA_S60V5
         Tools.drawS60V5Frame(g, imgArray[1], imgArray[11], imgArray[12], imgArray[13], imgArray[6], null);
        //#else
//#        g.drawImage(imgArray[1], Constant.UI_START_X, Constant.UI_START_Y, Graphics.LEFT | Graphics.TOP);
        //#endif
        if (this.byUiState >= 4) {
            return;
        }
        int menulength = 6;
        switch (byUiState) {
            case 0://角色列表界面
                //#if NOKIA_S60V5
                 Tools.drawS60V5Frame(g, imgArray[1], imgArray[11], imgArray[12], imgArray[13], imgArray[6], sArray[0]);
 //                Tools.drawS60V5Frame(g, this.imgArray[2], this.imgArray[7],
 //                        this.imgArray[6], this.imgArray[4], this.imgArray[5], sArray[0]);
                 int start_X = 10;
                 int start_Y = 41;
                 int rect_H = Constant.FONT_SMALL.getHeight() * 3 + 8;
                 int rect_Y = (Constant.NEW_END_LINE - start_Y - rect_H * 4) / 5;
                 for (int i = 0; i < 4; i++) {
 //                    Tools.drawRoundRect(g, this.imgArray[5], this.imgArray[10], (byte) 1, 232, 58, Constant.UI_START_X + 4, Constant.UI_START_Y + 28 + (i * 68));
                     Tools.drawRoundRect(g, imgArray[5], 0x9c9c9c, Constant.SCREEN_WIDTH - start_X * 2, rect_H,
                             start_X, start_Y + rect_Y + (rect_H + rect_Y) * i);
                     if (sDataArray.length > i * menulength && sDataArray[i * menulength] != null) {
                         Tools.drawShadowString(g, (byte) 1, sArray[1],
                                 Constant.UI_START_X + start_X + 15, start_Y + rect_Y + 4 + (i * (rect_H + rect_Y)),
                                 0xFFFFFF, 0x000000);
                         Tools.drawShadowString(g, (byte) 1, sArray[2],
                                 Constant.UI_START_X + start_X + 15, start_Y + rect_Y + 4 + (i * (rect_H + rect_Y)) + Constant.FONT_SMALL.getHeight(),
                                 0xFFFFFF, 0x000000);
                         Tools.drawShadowString(g, (byte) 1, sArray[3],
                                 Constant.UI_START_X + start_X + 15, start_Y + rect_Y + 4 + (i * (rect_H + rect_Y)) + Constant.FONT_SMALL.getHeight() * 2,
                                 0xFFFFFF, 0x000000);
                         Tools.drawShadowString(g, (byte) 1, sDataArray[i * menulength + 2],
                                 Constant.UI_START_X + start_X + 15 + Constant.FONT_SMALL.stringWidth(sArray[1]),
                                 start_Y + rect_Y + 4 + (i * (rect_H + rect_Y)), 0xFFFFFF, 0x000000);
                         Tools.drawShadowString(g, (byte) 1, sDataArray[i * menulength + 1],
                                 Constant.UI_START_X + start_X + 15 + Constant.FONT_SMALL.stringWidth(sArray[1]),
                                 start_Y + rect_Y + 4 + (i * (rect_H + rect_Y)) + Constant.FONT_SMALL.getHeight(), 0xFFFFFF, 0x000000);
                         Tools.drawShadowString(g, (byte) 1, sDataArray[i * menulength + 5],
                                 Constant.UI_START_X + start_X + 15 + Constant.FONT_SMALL.stringWidth(sArray[1]),
                                 start_Y + rect_Y + 4 + (i * (rect_H + rect_Y)) + Constant.FONT_SMALL.getHeight() * 2, 0xFFFFFF, 0x000000);
                         switch (Integer.parseInt(sDataArray[i * menulength + 4])) {
                             case Constant.PLAYER_SEX_WOMAN:
                                 switch (Integer.parseInt(sDataArray[i * menulength + 3])) {
                                     case Constant.PLAYER_OCCUPTION_SWORD:
                                         animation[3].showOnlyAni(g, Constant.UI_START_X + Constant.SCREEN_WIDTH * 3 / 4,
                                                 start_Y + rect_Y + 4 + (i * (rect_H + rect_Y)) + Constant.FONT_SMALL.getHeight() * 3, Constant.PLAYER_STATE_STAND, Constant.PLAYER_DIRECTION_DOWN);
                                         break;
                                     case Constant.PLAYER_OCCUPTION_ASSASSIN:
                                         animation[4].showOnlyAni(g, Constant.UI_START_X + Constant.SCREEN_WIDTH * 3 / 4,
                                                 start_Y + rect_Y + 4 + (i * (rect_H + rect_Y)) + Constant.FONT_SMALL.getHeight() * 3, Constant.PLAYER_STATE_STAND, Constant.PLAYER_DIRECTION_DOWN);
                                         break;
                                     case Constant.PLAYER_OCCUPTION_MASTER:
                                         animation[5].showOnlyAni(g, Constant.UI_START_X + Constant.SCREEN_WIDTH * 3 / 4,
                                                 start_Y + rect_Y + 4 + (i * (rect_H + rect_Y)) + Constant.FONT_SMALL.getHeight() * 3, Constant.PLAYER_STATE_STAND, Constant.PLAYER_DIRECTION_DOWN);
                                         break;
                                 }
                                 break;
                             case Constant.PLAYER_SEX_MAN:
                                 switch (Integer.parseInt(sDataArray[i * menulength + 3])) {
                                     case Constant.PLAYER_OCCUPTION_SWORD:
                                         animation[0].showOnlyAni(g, Constant.UI_START_X + Constant.SCREEN_WIDTH * 3 / 4,
                                                 start_Y + rect_Y + 4 + (i * (rect_H + rect_Y)) + Constant.FONT_SMALL.getHeight() * 3, Constant.PLAYER_STATE_STAND, Constant.PLAYER_DIRECTION_DOWN);
                                         break;
                                     case Constant.PLAYER_OCCUPTION_ASSASSIN:
                                         animation[1].showOnlyAni(g, Constant.UI_START_X + Constant.SCREEN_WIDTH * 3 / 4,
                                                 start_Y + rect_Y + 4 + (i * (rect_H + rect_Y)) + Constant.FONT_SMALL.getHeight() * 3, Constant.PLAYER_STATE_STAND, Constant.PLAYER_DIRECTION_DOWN);
                                         break;
                                     case Constant.PLAYER_OCCUPTION_MASTER:
                                         animation[2].showOnlyAni(g, Constant.UI_START_X + Constant.SCREEN_WIDTH * 3 / 4,
                                                 start_Y + rect_Y + 4 + (i * (rect_H + rect_Y)) + Constant.FONT_SMALL.getHeight() * 3, Constant.PLAYER_STATE_STAND, Constant.PLAYER_DIRECTION_DOWN);
                                         break;
                                 }
                                 break;
                         }
                     } else {
                         Tools.drawShadowString(g, (byte) 1, sArray[4],
                                 Constant.UI_START_X + start_X + 15,
                                 start_Y + rect_Y + 4 + (i * (rect_H + rect_Y)) + Constant.FONT_SMALL.getHeight(), 0xffffff, 0x000000);
                     }
                 }
 //                Tools.drawSelectMask(g, (byte) 2, imgArray[8], Constant.UI_START_X, iPositionY, Constant.DRAW_WIDTH);

                 Tools.drawSelectMask(g, (byte) 1, imgArray[8], Constant.UI_START_X, iPositionY, Constant.DRAW_WIDTH);
                 Tools.drawSelectMask(g, (byte) 2, imgArray[8], Constant.UI_START_X, iPositionY - rect_H - 5, Constant.DRAW_WIDTH);
                //#else
                //#if NOKIA_E72
//#                 Tools.drawE72Frame(g, imgArray[1], imgArray[6], sArray[0]);
                //#else
//#                Tools.drawFrame(g, Constant.UI_START_X, Constant.UI_START_Y, imgArray[1], this.imgArray[4], this.imgArray[8], imgArray[6], 0, 0, 24, 12, imgArray[6], 49, 0, 23, 12, sArray[0], 0xFFFFFF);
                //#endif
//#                this.startX = Constant.UI_START_X + ((Constant.DRAW_WIDTH - 232) >> 1);
//#                this.startY = Constant.UI_START_Y + 28 + UiInterFace.iScreenOffsetH;
//#                for (int i = 0; i < 4; i++) {
//#                    Tools.drawRoundRect(g, this.imgArray[5], this.imgArray[10], (byte) 1, 232, 58, this.startX, startY + (i * 68));
//#                    if (sDataArray.length > i * menulength && sDataArray[i * menulength] != null) {
//#                        Tools.drawShadowString(g, (byte) 1, sArray[1], this.startX + 7, this.startY + (i * 68), 0xFFFFFF, 0x000000);
//#                        Tools.drawShadowString(g, (byte) 1, sArray[2], this.startX + 7, this.startY + (i * 68) + 20, 0xFFFFFF, 0x000000);
//#                        Tools.drawShadowString(g, (byte) 1, sArray[3], this.startX + 7, this.startY + (i * 68) + 40, 0xFFFFFF, 0x000000);
//#                        Tools.drawShadowString(g, (byte) 1, sDataArray[i * menulength + 2], this.startX + 11 + Constant.FONT_SMALL.stringWidth(sArray[1]), this.startY + (i * 68), 0xFFFFFF, 0x000000);
//#                        Tools.drawShadowString(g, (byte) 1, sDataArray[i * menulength + 1], this.startX + 11 + Constant.FONT_SMALL.stringWidth(sArray[1]), this.startY + (i * 68) + 20, 0xFFFFFF, 0x000000);
//#                        Tools.drawShadowString(g, (byte) 1, sDataArray[i * menulength + 5], this.startX + 11 + Constant.FONT_SMALL.stringWidth(sArray[1]), this.startY + (i * 68) + 40, 0xFFFFFF, 0x000000);
//#                        switch (Integer.parseInt(sDataArray[i * menulength + 4])) {
//#                            case Constant.PLAYER_SEX_WOMAN:
//#                                switch (Integer.parseInt(sDataArray[i * menulength + 3])) {
//#                                    case Constant.PLAYER_OCCUPTION_SWORD:
//#                                        animation[3].showOnlyAni(g, this.startX + 198, this.startY + 57 + (i * 68), Constant.PLAYER_STATE_STAND, Constant.PLAYER_DIRECTION_DOWN);
//#                                        break;
//#                                    case Constant.PLAYER_OCCUPTION_ASSASSIN:
//#                                        animation[4].showOnlyAni(g, this.startX + 198, this.startY + 57 + (i * 68), Constant.PLAYER_STATE_STAND, Constant.PLAYER_DIRECTION_DOWN);
//#                                        break;
//#                                    case Constant.PLAYER_OCCUPTION_MASTER:
//#                                        animation[5].showOnlyAni(g, this.startX + 198, this.startY + 57 + (i * 68), Constant.PLAYER_STATE_STAND, Constant.PLAYER_DIRECTION_DOWN);
//#                                        break;
//#                                }
//#                                break;
//#                            case Constant.PLAYER_SEX_MAN:
//#                                switch (Integer.parseInt(sDataArray[i * menulength + 3])) {
//#                                    case Constant.PLAYER_OCCUPTION_SWORD:
//#                                        animation[0].showOnlyAni(g, this.startX + 198, this.startY + 57 + (i * 68), Constant.PLAYER_STATE_STAND, Constant.PLAYER_DIRECTION_DOWN);
//#                                        break;
//#                                    case Constant.PLAYER_OCCUPTION_ASSASSIN:
//#                                        animation[1].showOnlyAni(g, this.startX + 198, this.startY + 57 + (i * 68), Constant.PLAYER_STATE_STAND, Constant.PLAYER_DIRECTION_DOWN);
//#                                        break;
//#                                    case Constant.PLAYER_OCCUPTION_MASTER:
//#                                        animation[2].showOnlyAni(g, this.startX + 198, this.startY + 57 + (i * 68), Constant.PLAYER_STATE_STAND, Constant.PLAYER_DIRECTION_DOWN);
//#                                        break;
//#                                }
//#                                break;
//#                        }
//#                    } else {
//#                        Tools.drawShadowString(g, (byte) 1, sArray[4], this.startX + 11, this.startY + (i * 68) + 20, 0xffffff, 0x000000);
//#                    }
//#                }
//#                //选中状态
//#                Tools.drawSelectMask(g, (byte) 1, imgArray[8], Constant.UI_START_X, iPositionY, Constant.DRAW_WIDTH);
//#                Tools.drawSelectMask(g, (byte) 2, imgArray[8], Constant.UI_START_X, iPositionY - 58 - 5, Constant.DRAW_WIDTH);
                //#if NOKIA_E72
//#                 Tools.drawE72ScrollBar(g);
                //#endif
                //#endif
                break;
            case 1:
                break;
            case 2:
            case 3://创建角色界面
                //#if NOKIA_S60V5
                 //绘制光柱
                 startX = Constant.UI_START_X + (Constant.DRAW_WIDTH >> 1);
                 startY = Constant.UI_START_Y + 41;
                 g.drawImage(imgArray[7], startX - imgArray[7].getWidth(), startY, 0);
                 g.drawRegion(imgArray[7], 0, 0, this.imgArray[7].getWidth(), this.imgArray[7].getHeight(),
                         Constant.TRANS_MIRROR, startX - imgArray[7].getWidth() + imgArray[7].getWidth(),
                         startY, 0);
                 animation[0].show(g, Constant.UI_START_X, Constant.UI_START_Y);
                 animation[1].show(g, Constant.UI_START_X, Constant.UI_START_Y);
                 animation[2].show(g, Constant.UI_START_X, Constant.UI_START_Y);
                 //绘制动画影子
                 g.drawImage(MainView.imgShadow, this.animation[0].iPlayerX - (MainView.imgShadow.getWidth() >> 1),
                         this.animation[1].iPlayerY - (MainView.imgShadow.getHeight() >> 1), 0);
                 g.drawImage(MainView.imgShadow, this.animation[1].iPlayerX - (MainView.imgShadow.getWidth() >> 1),
                         this.animation[1].iPlayerY - (MainView.imgShadow.getHeight() >> 1), 0);
                 g.drawImage(MainView.imgShadow, this.animation[2].iPlayerX - (MainView.imgShadow.getWidth() >> 1),
                         this.animation[2].iPlayerY - (MainView.imgShadow.getHeight() >> 1), 0);
                 switch (GameBean.BY_CMD_PLAYER_JOB) {
                     case Constant.PLAYER_OCCUPTION_ASSASSIN:
                         Tools.drawShadowString(g, (byte) 1, sStrArray[2],
                                 startX - (Constant.FONT_SMALL.stringWidth(sStrArray[2]) >> 1),
                                 startY + 140, 0xFFFFFF, 0x000000);
                         Tools.drawShadowString(g, (byte) 1, sStrArray[3],
                                 startX - (Constant.FONT_SMALL.stringWidth(sStrArray[3]) >> 1),
                                 startY + 140 + Constant.FONT_SMALL_HEIGHT + 10, 0xFFFFFF, 0x000000);
                         break;
                     case Constant.PLAYER_OCCUPTION_SWORD:
                         Tools.drawShadowString(g, (byte) 1, sStrArray[0],
                                 startX - (Constant.FONT_SMALL.stringWidth(sStrArray[0]) >> 1),
                                 startY + 140, 0xFFFFFF, 0x000000);
                         Tools.drawShadowString(g, (byte) 1, sStrArray[1],
                                 startX - (Constant.FONT_SMALL.stringWidth(sStrArray[1]) >> 1),
                                 startY + 140 + Constant.FONT_SMALL_HEIGHT + 10, 0xFFFFFF, 0x000000);
                         break;
                     case Constant.PLAYER_OCCUPTION_MASTER:
                         Tools.drawShadowString(g, (byte) 1, sStrArray[4],
                                 startX - (Constant.FONT_SMALL.stringWidth(sStrArray[4]) >> 1),
                                 startY + 140, 0xFFFFFF, 0x000000);
                         Tools.drawShadowString(g, (byte) 1, sStrArray[5],
                                 startX - (Constant.FONT_SMALL.stringWidth(sStrArray[5]) >> 1),
                                 startY + 140 + Constant.FONT_SMALL_HEIGHT + 10, 0xFFFFFF, 0x000000);
                         break;
                 }
                 startX = Constant.UI_START_X + (Constant.DRAW_WIDTH - 232 >> 1);
                 startY = Constant.UI_START_Y + Constant.END_LINE - 140;
                 Tools.drawPopUp(g, this.byPopState, startX, startY, 232, 110, this.imgArray[5], 0x9C9C9C,
                         null, 0, 0, 0, 0, null, 0, 0, 0, 0, null, null);
                 //在弹出层上绘制内容
                 if (this.byPopState != 4) {
                     return;
                 }
                 //标题
                 g.drawRegion(this.imgArray[2], 26, 0, 50, 13, Constant.TRANS_NONE, Constant.UI_START_X + (Constant.DRAW_WIDTH - 50 >> 1),
                         startY + 3 + (24 - 13 >> 1), 0);
                 startX += 50;
                 startY += 30;

                 if (iSelectIndex == 1) {
                     //用户选择的职业
                     g.drawRegion(this.imgArray[2], 176, 0, 25, 13, Constant.TRANS_NONE, startX, startY, 0);
                     switch (GameBean.BY_CMD_PLAYER_JOB) {
                         case Constant.PLAYER_OCCUPTION_ASSASSIN:
                             g.drawRegion(this.imgArray[2], 230, 0, 30, 13, Constant.TRANS_NONE, startX + 50, startY, 0);
                             break;
                         case Constant.PLAYER_OCCUPTION_SWORD:
                             g.drawRegion(this.imgArray[2], 260, 0, 28, 13, Constant.TRANS_NONE, startX + 50, startY, 0);
                             break;
                         case Constant.PLAYER_OCCUPTION_MASTER:
                             g.drawRegion(this.imgArray[2], 288, 0, 30, 13, Constant.TRANS_NONE, startX + 50, startY, 0);
                             break;
                     }
                     Tools.drawArrow(g, imgArray[4], (byte) 1, startX + 35, startY + 3);
                     Tools.drawArrow(g, imgArray[4], (byte) 2, startX + 88, startY + 3);
                 } else {
                     //用户选择的职业
                     g.drawRegion(this.imgArray[2], 176, 13, 25, 13, Constant.TRANS_NONE, startX, startY, 0);
                     switch (GameBean.BY_CMD_PLAYER_JOB) {
                         case Constant.PLAYER_OCCUPTION_ASSASSIN:
                             g.drawRegion(this.imgArray[2], 230, 14, 30, 13, Constant.TRANS_NONE, startX + 50, startY, 0);
                             break;
                         case Constant.PLAYER_OCCUPTION_SWORD:
                             g.drawRegion(this.imgArray[2], 260, 13, 28, 13, Constant.TRANS_NONE, startX + 50, startY, 0);
                             break;
                         case Constant.PLAYER_OCCUPTION_MASTER:
                             g.drawRegion(this.imgArray[2], 288, 14, 30, 13, Constant.TRANS_NONE, startX + 50, startY, 0);
                             break;
                     }
                     Tools.drawArrow(g, imgArray[4], (byte) 5, startX + 35, startY + 3);
                     Tools.drawArrow(g, imgArray[4], (byte) 6, startX + 88, startY + 3);
                 }
                 startY += 20;
                 //性别
                 if (iSelectIndex == 2) {
                     //用户选择的性别
                     g.drawRegion(this.imgArray[2], 151, 0, 25, 13, Constant.TRANS_NONE, startX, startY, 0);
                     if (GameBean.BY_CMD_PLAYER_SEX == Constant.PLAYER_SEX_MAN) {
                         g.drawRegion(this.imgArray[2], 200, 0, 15, 13, Constant.TRANS_NONE, startX + 50, startY, 0);
                     } else if (GameBean.BY_CMD_PLAYER_SEX == Constant.PLAYER_SEX_WOMAN) {
                         g.drawRegion(this.imgArray[2], 215, 0, 15, 13, Constant.TRANS_NONE, startX + 50, startY, 0);
                     }
                     //绘制左右选择的图片
                     Tools.drawArrow(g, imgArray[4], (byte) 1, startX + 35, startY + 3);
                     Tools.drawArrow(g, imgArray[4], (byte) 2, startX + 73, startY + 3);
                 } else {
                     //用户选择的性别
                     g.drawRegion(this.imgArray[2], 151, 13, 25, 13, Constant.TRANS_NONE, startX, startY, 0);
                     if (GameBean.BY_CMD_PLAYER_SEX == Constant.PLAYER_SEX_MAN) {
                         g.drawRegion(this.imgArray[2], 200, 13, 15, 13, Constant.TRANS_NONE, startX + 50, startY, 0);
                     } else if (GameBean.BY_CMD_PLAYER_SEX == Constant.PLAYER_SEX_WOMAN) {
                         g.drawRegion(this.imgArray[2], 215, 14, 15, 13, Constant.TRANS_NONE, startX + 50, startY, 0);
                     }
                     //绘制左右选择的图片
                     Tools.drawArrow(g, imgArray[4], (byte) 5, startX + 35, startY + 3);
                     Tools.drawArrow(g, imgArray[4], (byte) 6, startX + 73, startY + 3);
                 }
                 startY += 20;

                 //姓名
                 if (iSelectIndex == 3) {
                     if (GameBean.STR_CMD_PLAYER_NICK != null && GameBean.STR_CMD_PLAYER_NICK.length() > 0) {
                         g.drawRegion(this.imgArray[2], 126, 0, 25, 13, Constant.TRANS_NONE, startX, startY, 0);
                         Tools.drawShadowString(g, (byte) 1, GameBean.STR_CMD_PLAYER_NICK, startX + 50, startY - ((Constant.FONT_SMALL_HEIGHT - 13) >> 1), 0x00CCFF, 0x333333);
                     } else {
                         g.drawRegion(this.imgArray[2], 126, 0, 25, 13, Constant.TRANS_NONE, startX, startY, 0);
                     }
                 } else {
                     if (GameBean.STR_CMD_PLAYER_NICK != null && GameBean.STR_CMD_PLAYER_NICK.length() > 0) {
                         g.drawRegion(this.imgArray[2], 126, 13, 25, 13, Constant.TRANS_NONE, startX, startY, 0);
                         Tools.drawShadowString(g, (byte) 1, GameBean.STR_CMD_PLAYER_NICK, startX + 50, startY - ((Constant.FONT_SMALL_HEIGHT - 13) >> 1), 0xFFFFFF, 0x333333);
                     } else {
                         g.drawRegion(this.imgArray[2], 126, 13, 25, 13, Constant.TRANS_NONE, startX, startY, 0);
                     }
                 }
                 startY += 20;
                 //进入游戏
                 if (iSelectIndex == 4) {
                     g.drawRegion(this.imgArray[2], 319, 0, 57, 13, Constant.TRANS_NONE,
                             Constant.UI_START_X + (Constant.DRAW_WIDTH - 57 >> 1), startY, 0);
                 } else {
                     g.drawRegion(this.imgArray[2], 319, 14, 57, 13, Constant.TRANS_NONE,
                             Constant.UI_START_X + (Constant.DRAW_WIDTH - 57 >> 1), startY, 0);
                 }
                 //绘制确定和取消线
                 if (iSelectIndex == 2 || iSelectIndex == 3) {
                     Tools.drawSelectMask(g, (byte) 1, imgArray[8], Constant.UI_START_X, iPositionY, Constant.DRAW_WIDTH, imgArray[4], imgArray[6], 0, 0, 0, 0, imgArray[6], 0, 0, 0, 0);
                 } else {
                     Tools.drawSelectMask(g, (byte) 1, imgArray[8], Constant.UI_START_X, iPositionY, Constant.DRAW_WIDTH, null, null, 0, 0, 0, 0, null, 0, 0, 0, 0);
                 }
                //#else
//#                this.startX = Constant.UI_START_X + (Constant.DRAW_WIDTH - 232 >> 1);
//#                this.startY = Constant.UI_START_Y + Constant.DRAW_HEIGHT - 137;
//#                Tools.drawPopUp(g, this.byPopState, this.startX, this.startY, 232, 105, this.imgArray[5], 0x9C9C9C, null, 0, 0, 0, 0, null, 0, 0, 0, 0, null, null);
//#                animation[0].show(g, Constant.UI_START_X, Constant.UI_START_Y);
//#                animation[1].show(g, Constant.UI_START_X, Constant.UI_START_Y);
//#                animation[2].show(g, Constant.UI_START_X, Constant.UI_START_Y);
//#                switch (GameBean.BY_CMD_PLAYER_JOB) {
//#                    case Constant.PLAYER_OCCUPTION_ASSASSIN:
//#                        Tools.drawShadowString(g, (byte) 1, sStrArray[2],
//#                                Constant.UI_START_X + (Constant.DRAW_WIDTH - Constant.FONT_SMALL.stringWidth(sStrArray[2]) >> 1),
//#                                this.startY - 43, 0xFFFFFF, 0x000000);
//#                        Tools.drawShadowString(g, (byte) 1, sStrArray[3],
//#                                Constant.UI_START_X + (Constant.DRAW_WIDTH - Constant.FONT_SMALL.stringWidth(sStrArray[3]) >> 1),
//#                                this.startY - 43 + Constant.FONT_SMALL_HEIGHT, 0xFFFFFF, 0x000000);
//#                        break;
//#                    case Constant.PLAYER_OCCUPTION_SWORD:
//#                        Tools.drawShadowString(g, (byte) 1, sStrArray[0],
//#                                Constant.UI_START_X + (Constant.DRAW_WIDTH - Constant.FONT_SMALL.stringWidth(sStrArray[0]) >> 1),
//#                                this.startY - 43, 0xFFFFFF, 0x000000);
//#                        Tools.drawShadowString(g, (byte) 1, sStrArray[1],
//#                                Constant.UI_START_X + (Constant.DRAW_WIDTH - Constant.FONT_SMALL.stringWidth(sStrArray[1]) >> 1),
//#                                this.startY - 43 + Constant.FONT_SMALL_HEIGHT, 0xFFFFFF, 0x000000);
//#                        break;
//#                    case Constant.PLAYER_OCCUPTION_MASTER:
//#                        Tools.drawShadowString(g, (byte) 1, sStrArray[4],
//#                                Constant.UI_START_X + (Constant.DRAW_WIDTH - Constant.FONT_SMALL.stringWidth(sStrArray[4]) >> 1),
//#                                this.startY - 43, 0xFFFFFF, 0x000000);
//#                        Tools.drawShadowString(g, (byte) 1, sStrArray[5],
//#                                Constant.UI_START_X + (Constant.DRAW_WIDTH - Constant.FONT_SMALL.stringWidth(sStrArray[5]) >> 1),
//#                                this.startY - 43 + Constant.FONT_SMALL_HEIGHT, 0xFFFFFF, 0x000000);
//#                        break;
//#                }
//#                //绘制动画影子
//#                g.drawImage(MainView.imgShadow, this.animation[0].iPlayerX - (MainView.imgShadow.getWidth() >> 1),
//#                        this.animation[1].iPlayerY - (MainView.imgShadow.getHeight() >> 1), 0);
//#                g.drawImage(MainView.imgShadow, this.animation[1].iPlayerX - (MainView.imgShadow.getWidth() >> 1),
//#                        this.animation[1].iPlayerY - (MainView.imgShadow.getHeight() >> 1), 0);
//#                g.drawImage(MainView.imgShadow, this.animation[2].iPlayerX - (MainView.imgShadow.getWidth() >> 1),
//#                        this.animation[2].iPlayerY - (MainView.imgShadow.getHeight() >> 1), 0);
//#                //在弹出层上绘制内容
//#                if (this.byPopState != 4) {
//#                    return;
//#                }
//#                //绘制文字内容
//#                int iStrStartY = startY + 22;
//#                //绘制确定和取消线
//#                if (iSelectIndex == 2 || iSelectIndex == 3) {
//#                    Tools.drawSelectMask(g, (byte) 1, imgArray[8], Constant.UI_START_X, iPositionY, Constant.DRAW_WIDTH, imgArray[4], imgArray[6], 0, 0, 0, 0, imgArray[6], 0, 0, 0, 0);
//#                } else {
//#                    Tools.drawSelectMask(g, (byte) 1, imgArray[8], Constant.UI_START_X, iPositionY, Constant.DRAW_WIDTH, null, null, 0, 0, 0, 0, null, 0, 0, 0, 0);
//#                }
//#                //标题
//#                g.drawRegion(this.imgArray[2], 26, 0, 50, 13, Constant.TRANS_NONE, startX + 91, startY + 3, 0);
//#
//#                if (iSelectIndex == 1) {
//#                    //用户选择的职业
//#                    g.drawRegion(this.imgArray[2], 176, 0, 25, 13, Constant.TRANS_NONE, startX + 69, iStrStartY, 0);
//#                    g.drawRegion(this.imgArray[2], 122, 13, 3, 13, Constant.TRANS_NONE, startX + 99, iStrStartY, 0);
//#                    switch (GameBean.BY_CMD_PLAYER_JOB) {
//#                        case Constant.PLAYER_OCCUPTION_ASSASSIN:
//#                            g.drawRegion(this.imgArray[2], 230, 0, 30, 13, Constant.TRANS_NONE, startX + 119, iStrStartY, 0);
//#                            break;
//#                        case Constant.PLAYER_OCCUPTION_SWORD:
//#                            g.drawRegion(this.imgArray[2], 260, 0, 28, 13, Constant.TRANS_NONE, startX + 119, iStrStartY, 0);
//#                            break;
//#                        case Constant.PLAYER_OCCUPTION_MASTER:
//#                            g.drawRegion(this.imgArray[2], 288, 0, 30, 13, Constant.TRANS_NONE, startX + 119, iStrStartY, 0);
//#                            break;
//#                    }
//#                    Tools.drawArrow(g, imgArray[4], (byte) 1, startX + 109, iStrStartY + 3);
//#                    Tools.drawArrow(g, imgArray[4], (byte) 2, startX + 154, iStrStartY + 3);
//#                } else {
//#                    //用户选择的职业
//#                    g.drawRegion(this.imgArray[2], 176, 13, 25, 13, Constant.TRANS_NONE, startX + 69, iStrStartY, 0);
//#                    //冒号
//#                    g.drawRegion(this.imgArray[2], 119, 13, 3, 13, Constant.TRANS_NONE, startX + 99, iStrStartY, 0);
//#                    switch (GameBean.BY_CMD_PLAYER_JOB) {
//#                        case Constant.PLAYER_OCCUPTION_ASSASSIN:
//#                            g.drawRegion(this.imgArray[2], 230, 14, 30, 13, Constant.TRANS_NONE, startX + 119, iStrStartY, 0);
//#                            break;
//#                        case Constant.PLAYER_OCCUPTION_SWORD:
//#                            g.drawRegion(this.imgArray[2], 260, 13, 28, 13, Constant.TRANS_NONE, startX + 119, iStrStartY, 0);
//#                            break;
//#                        case Constant.PLAYER_OCCUPTION_MASTER:
//#                            g.drawRegion(this.imgArray[2], 288, 14, 30, 13, Constant.TRANS_NONE, startX + 119, iStrStartY, 0);
//#                            break;
//#                    }
//#                    if (this.iState == 1) {
//#                        Tools.drawArrow(g, imgArray[4], (byte) 1, startX + 107, iStrStartY + 3);
//#                        Tools.drawArrow(g, imgArray[4], (byte) 6, startX + 154, iStrStartY + 3);
//#                    } else if (iState == 2) {
//#                        Tools.drawArrow(g, imgArray[4], (byte) 5, startX + 109, iStrStartY + 3);
//#                        Tools.drawArrow(g, imgArray[4], (byte) 2, startX + 156, iStrStartY + 3);
//#                    } else {
//#                        Tools.drawArrow(g, imgArray[4], (byte) 5, startX + 109, iStrStartY + 3);
//#                        Tools.drawArrow(g, imgArray[4], (byte) 6, startX + 154, iStrStartY + 3);
//#                    }
//#                }
//#                //性别
//#                if (iSelectIndex == 2) {
//#                    //用户选择的性别
//#                    g.drawRegion(this.imgArray[2], 151, 0, 25, 13, Constant.TRANS_NONE, startX + 69, iStrStartY + 20, 0);
//#                    g.drawRegion(this.imgArray[2], 122, 13, 3, 13, Constant.TRANS_NONE, startX + 99, iStrStartY + 20, 0);
//#                    if (GameBean.BY_CMD_PLAYER_SEX == Constant.PLAYER_SEX_MAN) {
//#                        g.drawRegion(this.imgArray[2], 200, 0, 15, 13, Constant.TRANS_NONE, startX + 119, iStrStartY + 20, 0);
//#                    } else if (GameBean.BY_CMD_PLAYER_SEX == Constant.PLAYER_SEX_WOMAN) {
//#                        g.drawRegion(this.imgArray[2], 215, 0, 15, 13, Constant.TRANS_NONE, startX + 119, iStrStartY + 20, 0);
//#                    }
//#                    //绘制左右选择的图片
//#                    Tools.drawArrow(g, imgArray[4], (byte) 1, startX + 109, iStrStartY + 20 + 3);
//#                    Tools.drawArrow(g, imgArray[4], (byte) 2, startX + 141, iStrStartY + 20 + 3);
//#                } else {
//#                    //用户选择的性别
//#                    g.drawRegion(this.imgArray[2], 151, 13, 25, 13, Constant.TRANS_NONE, startX + 69, iStrStartY + 20, 0);
//#                    //冒号
//#                    g.drawRegion(this.imgArray[2], 119, 13, 3, 13, Constant.TRANS_NONE, startX + 99, iStrStartY + 20, 0);
//#                    if (GameBean.BY_CMD_PLAYER_SEX == Constant.PLAYER_SEX_MAN) {
//#                        g.drawRegion(this.imgArray[2], 200, 13, 15, 13, Constant.TRANS_NONE, startX + 119, iStrStartY + 20, 0);
//#                    } else if (GameBean.BY_CMD_PLAYER_SEX == Constant.PLAYER_SEX_WOMAN) {
//#                        g.drawRegion(this.imgArray[2], 215, 14, 15, 13, Constant.TRANS_NONE, startX + 119, iStrStartY + 20, 0);
//#                    }
//#                    //绘制左右选择的图片
//#                    if (this.iState == 1) {
//#                        Tools.drawArrow(g, imgArray[4], (byte) 1, startX + 107, iStrStartY + 20 + 3);
//#                        Tools.drawArrow(g, imgArray[4], (byte) 6, startX + 141, iStrStartY + 20 + 3);
//#                    } else if (iState == 2) {
//#                        Tools.drawArrow(g, imgArray[4], (byte) 5, startX + 109, iStrStartY + 20 + 3);
//#                        Tools.drawArrow(g, imgArray[4], (byte) 2, startX + 143, iStrStartY + 20 + 3);
//#                    } else {
//#                        Tools.drawArrow(g, imgArray[4], (byte) 5, startX + 109, iStrStartY + 20 + 3);
//#                        Tools.drawArrow(g, imgArray[4], (byte) 6, startX + 141, iStrStartY + 20 + 3);
//#                    }
//#                }
//#
//#                //姓名
//#                if (iSelectIndex == 3) {
//#                    if (GameBean.STR_CMD_PLAYER_NICK != null && GameBean.STR_CMD_PLAYER_NICK.length() > 0) {
//#                        int iStartX = Constant.UI_START_X + ((Constant.DRAW_WIDTH - 30 - Constant.FONT_SMALL.stringWidth(GameBean.STR_CMD_PLAYER_NICK)) >> 1);
//#                        g.drawRegion(this.imgArray[2], 126, 0, 25, 13, Constant.TRANS_NONE, iStartX, iStrStartY + 40, 0);
//#                        g.drawRegion(this.imgArray[2], 122, 13, 3, 13, Constant.TRANS_NONE, iStartX + 27, iStrStartY + 40, 0);
//#                        Tools.drawShadowString(g, (byte) 1, GameBean.STR_CMD_PLAYER_NICK, iStartX + 30, iStrStartY + 40 - ((Constant.FONT_SMALL_HEIGHT - 13) >> 1), 0x00CCFF, 0x333333);
//#                    } else {
//#                        g.drawRegion(this.imgArray[2], 126, 0, 25, 13, Constant.TRANS_NONE, startX + 69, iStrStartY + 40, 0);
//#                        g.drawRegion(this.imgArray[2], 122, 13, 3, 13, Constant.TRANS_NONE, startX + 99, iStrStartY + 40, 0);
//#                    }
//#                } else {
//#                    if (GameBean.STR_CMD_PLAYER_NICK != null && GameBean.STR_CMD_PLAYER_NICK.length() > 0) {
//#                        int iStartX = Constant.UI_START_X + ((Constant.DRAW_WIDTH - 30 - Constant.FONT_SMALL.stringWidth(GameBean.STR_CMD_PLAYER_NICK)) >> 1);
//#                        g.drawRegion(this.imgArray[2], 126, 13, 25, 13, Constant.TRANS_NONE, iStartX, iStrStartY + 40, 0);
//#                        //冒号
//#                        g.drawRegion(this.imgArray[2], 119, 13, 3, 13, Constant.TRANS_NONE, Constant.UI_START_X + 103, iStrStartY + 40, 0);
//#                        Tools.drawShadowString(g, (byte) 1, GameBean.STR_CMD_PLAYER_NICK, iStartX + 30, iStrStartY + 40 - ((Constant.FONT_SMALL_HEIGHT - 13) >> 1), 0xFFFFFF, 0x333333);
//#                    } else {
//#                        g.drawRegion(this.imgArray[2], 126, 13, 25, 13, Constant.TRANS_NONE, startX + 69, iStrStartY + 40, 0);
//#                        //冒号
//#                        g.drawRegion(this.imgArray[2], 119, 13, 3, 13, Constant.TRANS_NONE, startX + 99, iStrStartY + 40, 0);
//#                    }
//#                }
//#                if (iSelectIndex == 4) {
//#                    g.drawRegion(this.imgArray[2], 319, 0, 57, 13, Constant.TRANS_NONE, startX + ((232 - 57) >> 1), iStrStartY + 60 - 1, 0);
//#                } else {
//#                    //进入游戏
//#                    g.drawRegion(this.imgArray[2], 319, 14, 57, 13, Constant.TRANS_NONE, startX + ((232 - 57) >> 1), iStrStartY + 60 - 1, 0);
//#                }
//#                //绘制光柱
//#                g.drawImage(imgArray[7], iArray[6] + (Constant.DRAW_WIDTH >> 1) - 75, Constant.UI_START_Y, 0);
//#                g.drawRegion(imgArray[7], 0, 0, this.imgArray[7].getWidth(), this.imgArray[7].getHeight(), Constant.TRANS_MIRROR, this.iArray[6] + (Constant.DRAW_WIDTH >> 1) + this.imgArray[7].getWidth() - 75, Constant.UI_START_Y, 0);
                //#if NOKIA_E72
//#                 g.drawRegion(imgArray[6], 0, 0, 24, 12, Constant.TRANS_NONE, Constant.UI_START_X + 10, Constant.UI_START_Y + Constant.DRAW_HEIGHT - 16, 0);
//#                 g.drawRegion(imgArray[6], 49, 0, 23, 12, Constant.TRANS_NONE, Constant.UI_START_X + Constant.DRAW_WIDTH - 33, Constant.UI_START_Y + Constant.DRAW_HEIGHT - 16, 0);
                //#else
//#                Tools.drawSelectMask(g, (byte) 2, imgArray[8], Constant.UI_START_X, Constant.UI_START_Y + Constant.DRAW_HEIGHT - 30, Constant.DRAW_WIDTH, null, imgArray[6], 0, 0, 24, 12, imgArray[6], 49, 0, 23, 12);
                //#endif
                //#endif
                break;
            default:
                break;
        }
    }

    public void clearCreateRole() {
        this.imgArray = null;
        this.iLineConfigArray = null;
        this.iArray = null;
        this.animation = null;
        this.sArray = null;
        this.sStrArray = null;
//        this.sDataArray = null;
        //#if NOKIA_E72
//#         Tools.clearE72ScollBar();
        //#endif
    }

    public void changeSelectRole(byte type, byte index, byte sex, boolean changesex, boolean changejob, byte direct) {
        if (this.animation == null) {
            return;
        }
        Tools.printLog("选择角色");
        if (type == 1) {
            this.animation[0] = new Player(Constant.PLAYER_OCCUPTION_SWORD, Constant.PLAYER_SEX_MAN, (byte) -1);
            this.animation[0].addAvatorAni("364", Constant.PLAYER_AVATAR_HEAR, true);
            this.animation[1] = new Player(Constant.PLAYER_OCCUPTION_ASSASSIN, Constant.PLAYER_SEX_MAN, (byte) -1);
            this.animation[1].addAvatorAni("375", Constant.PLAYER_AVATAR_HEAR, true);
            this.animation[2] = new Player(Constant.PLAYER_OCCUPTION_MASTER, Constant.PLAYER_SEX_MAN, (byte) -1);
            this.animation[2].addAvatorAni("354", Constant.PLAYER_AVATAR_HEAR, true);
            this.animation[3] = new Player(Constant.PLAYER_OCCUPTION_SWORD, Constant.PLAYER_SEX_WOMAN, (byte) -1);
            this.animation[3].addAvatorAni("423", Constant.PLAYER_AVATAR_HEAR, true);
            this.animation[4] = new Player(Constant.PLAYER_OCCUPTION_ASSASSIN, Constant.PLAYER_SEX_WOMAN, (byte) -1);
            this.animation[4].addAvatorAni("389", Constant.PLAYER_AVATAR_HEAR, true);
            this.animation[5] = new Player(Constant.PLAYER_OCCUPTION_MASTER, Constant.PLAYER_SEX_WOMAN, (byte) -1);
            this.animation[5].addAvatorAni("370", Constant.PLAYER_AVATAR_HEAR, true);
            return;
        }
        if (iMenuArray == null) {
            iMenuArray = new int[]{0, 1, 2};
        }
        if (direct != -1) {
            Tools.changeRoundMenu(iMenuArray, direct);
        }
        Tools.printLog("direct" + direct + "changesex" + changesex + "changejob" + changejob);
        if (changesex) {
            this.animation[0] = null;
            this.animation[1] = null;
            this.animation[2] = null;
            if (sex == Constant.PLAYER_SEX_MAN) {
                this.animation[0] = new Player(Constant.PLAYER_OCCUPTION_SWORD, Constant.PLAYER_SEX_MAN, (byte) -1);
                this.animation[0].addAvatorAni("385", Constant.PLAYER_AVATAR_CLOTH, true);
                this.animation[0].addAvatorAni("386", Constant.PLAYER_AVATAR_TROUSERS, true);
                this.animation[0].addAvatorAni("387", Constant.PLAYER_AVATAR_SHOES, true);
                this.animation[0].addAvatorAni("384", Constant.PLAYER_AVATAR_HEAD, true);
                this.animation[0].addAvatorAni("388", Constant.PLAYER_AVATAR_WEAPON, true);
                this.animation[0].addAvatorAni("364", Constant.PLAYER_AVATAR_HEAR, true);
                this.animation[0].changeAction(Constant.PLAYER_STATE_STAND, Constant.PLAYER_DIRECTION_DOWN, false, false);
                this.animation[1] = new Player(Constant.PLAYER_OCCUPTION_ASSASSIN, Constant.PLAYER_SEX_MAN, (byte) -1);
                this.animation[1].addAvatorAni("401", Constant.PLAYER_AVATAR_CLOTH, true);
                this.animation[1].addAvatorAni("402", Constant.PLAYER_AVATAR_TROUSERS, true);
                this.animation[1].addAvatorAni("403", Constant.PLAYER_AVATAR_SHOES, true);
                this.animation[1].addAvatorAni("400", Constant.PLAYER_AVATAR_HEAD, true);
                this.animation[1].addAvatorAni("421", Constant.PLAYER_AVATAR_WEAPON, true);
                this.animation[1].addAvatorAni("375", Constant.PLAYER_AVATAR_HEAR, true);
                this.animation[1].changeAction(Constant.PLAYER_STATE_STAND, Constant.PLAYER_DIRECTION_DOWN, false, false);
                this.animation[2] = new Player(Constant.PLAYER_OCCUPTION_MASTER, Constant.PLAYER_SEX_MAN, (byte) -1);
                this.animation[2].addAvatorAni("409", Constant.PLAYER_AVATAR_CLOTH, true);
                this.animation[2].addAvatorAni("410", Constant.PLAYER_AVATAR_TROUSERS, true);
                this.animation[2].addAvatorAni("411", Constant.PLAYER_AVATAR_SHOES, true);
                this.animation[2].addAvatorAni("408", Constant.PLAYER_AVATAR_HEAD, true);
                this.animation[2].addAvatorAni("374", Constant.PLAYER_AVATAR_WEAPON, true);
                this.animation[2].addAvatorAni("354", Constant.PLAYER_AVATAR_HEAR, true);
                this.animation[2].changeAction(Constant.PLAYER_STATE_STAND, Constant.PLAYER_DIRECTION_DOWN, false, false);
            } else {
                this.animation[0] = new Player(Constant.PLAYER_OCCUPTION_SWORD, Constant.PLAYER_SEX_WOMAN, (byte) -1);
                this.animation[0].addAvatorAni("429", Constant.PLAYER_AVATAR_CLOTH, true);
                this.animation[0].addAvatorAni("430", Constant.PLAYER_AVATAR_TROUSERS, true);
                this.animation[0].addAvatorAni("431", Constant.PLAYER_AVATAR_SHOES, true);
                this.animation[0].addAvatorAni("428", Constant.PLAYER_AVATAR_HEAD, true);
                this.animation[0].addAvatorAni("388", Constant.PLAYER_AVATAR_WEAPON, true);
                this.animation[0].addAvatorAni("423", Constant.PLAYER_AVATAR_HEAR, true);
                this.animation[0].changeAction(Constant.PLAYER_STATE_STAND, Constant.PLAYER_DIRECTION_DOWN, false, false);
                this.animation[1] = new Player(Constant.PLAYER_OCCUPTION_ASSASSIN, Constant.PLAYER_SEX_WOMAN, (byte) -1);
                this.animation[1].addAvatorAni("417", Constant.PLAYER_AVATAR_CLOTH, true);
                this.animation[1].addAvatorAni("418", Constant.PLAYER_AVATAR_TROUSERS, true);
                this.animation[1].addAvatorAni("419", Constant.PLAYER_AVATAR_SHOES, true);
                this.animation[1].addAvatorAni("416", Constant.PLAYER_AVATAR_HEAD, true);
                this.animation[1].addAvatorAni("421", Constant.PLAYER_AVATAR_WEAPON, true);
                this.animation[1].addAvatorAni("389", Constant.PLAYER_AVATAR_HEAR, true);
                this.animation[1].changeAction(Constant.PLAYER_STATE_STAND, Constant.PLAYER_DIRECTION_DOWN, false, false);
                this.animation[2] = new Player(Constant.PLAYER_OCCUPTION_MASTER, Constant.PLAYER_SEX_WOMAN, (byte) -1);
                this.animation[2].addAvatorAni("413", Constant.PLAYER_AVATAR_CLOTH, true);
                this.animation[2].addAvatorAni("414", Constant.PLAYER_AVATAR_TROUSERS, true);
                this.animation[2].addAvatorAni("415", Constant.PLAYER_AVATAR_SHOES, true);
                this.animation[2].addAvatorAni("412", Constant.PLAYER_AVATAR_HEAD, true);
                this.animation[2].addAvatorAni("374", Constant.PLAYER_AVATAR_WEAPON, true);
                this.animation[2].addAvatorAni("370", Constant.PLAYER_AVATAR_HEAR, true);
                this.animation[2].changeAction(Constant.PLAYER_STATE_STAND, Constant.PLAYER_DIRECTION_DOWN, false, false);
            }
        }
        if (changejob) {
            this.animation[iMenuArray[0]].changeAction(Constant.PLAYER_STATE_STAND, Constant.PLAYER_DIRECTION_LEFT, false, true);
            this.animation[iMenuArray[1]].changeAction(Constant.PLAYER_STATE_RUN, Constant.PLAYER_DIRECTION_DOWN, false, true);
            this.animation[iMenuArray[2]].changeAction(Constant.PLAYER_STATE_STAND, Constant.PLAYER_DIRECTION_RIGHT, false, true);
            //#if NOKIA_E72
//#             this.animation[iMenuArray[0]].iPlayerX = this.iArray[6] + 50;
//#             this.animation[iMenuArray[0]].iPlayerY = this.iArray[7] + 80;
//#             this.animation[iMenuArray[1]].iPlayerX = this.iArray[6] + (Constant.DRAW_WIDTH >> 1);
//#             this.animation[iMenuArray[1]].iPlayerY = this.iArray[7] + 80;
//#             this.animation[iMenuArray[2]].iPlayerX = this.iArray[6] + Constant.DRAW_WIDTH - 50;
//#             this.animation[iMenuArray[2]].iPlayerY = this.iArray[7] + 80;
            //#else
            this.animation[iMenuArray[0]].iPlayerX = this.iArray[6] + 50;
            this.animation[iMenuArray[0]].iPlayerY = this.iArray[7] + 140;
            this.animation[iMenuArray[1]].iPlayerX = this.iArray[6] + (Constant.DRAW_WIDTH >> 1);
            this.animation[iMenuArray[1]].iPlayerY = this.iArray[7] + 140;
            this.animation[iMenuArray[2]].iPlayerX = this.iArray[6] + Constant.DRAW_WIDTH - 50;
            this.animation[iMenuArray[2]].iPlayerY = this.iArray[7] + 140;
            //#endif
        }
        if (this.animation[3] == null) {
            this.animation[3] = new Player(Constant.PLAYER_OCCUPTION_SWORD, Constant.PLAYER_SEX_MAN, (byte) -1);
            this.animation[4] = new Player(Constant.PLAYER_OCCUPTION_ASSASSIN, Constant.PLAYER_SEX_MAN, (byte) -1);
            this.animation[5] = new Player(Constant.PLAYER_OCCUPTION_MASTER, Constant.PLAYER_SEX_MAN, (byte) -1);
        }
    }
    /**
     * 服务器列表
     */
    public byte byPageIndex;
    public byte byMaxPage;
    public byte numPerPage;

    public void initServerList() {
        this.byUiState = 0;
        this.sArray = new String[]{"选择服务器", "服务器", "角色数", "状态", "正常", "推荐", "新服", "维护", "离线"};
        //#if NOKIA_S60V5
         this.numPerPage = 8;
         try {
             this.imgArray = new Image[9];
             this.imgArray[0] = ResManager.createImage(90000041); //小箭头图片
             this.imgArray[1] = Tools.makeBlueMask(); //蓝色选择条
             this.imgArray[2] = ResManager.createImage(90000017);//背景图片
             this.imgArray[3] = Tools.makeTransparent(ResManager.createImage(90000051), 255); //边框图片
             this.imgArray[4] = ResManager.createImage(90000086);//蓝条
             this.imgArray[5] = ResManager.createImage(90000043);  //文字图片
             this.imgArray[6] = ResManager.createImage(90000085);//确认按钮图片
             this.imgArray[7] = ResManager.createImage(90000084);//方向键图片
             this.imgArray[8] = ResManager.createImage(90000047);//数字图片
         } catch (Exception e) {
             if (Constant.DEBUG) {
                 e.printStackTrace();
             }
         }
        //#else
//#        this.numPerPage = 8;
//#        imgArray = new Image[5];
//#        try {
//#            //箭头图片
//#            this.imgArray[0] = ResManager.createImage(90000041);
//#            //蓝色光片
//#            this.imgArray[1] = Tools.createPicFromGrayscale(ResManager.createImage(90000029), 0x0099ff);
//#            //背景图片
            //#if NORMAL_240_400
//#             imgArray[2] = ResManager.createImage(90000017);
//#             imgArray[2] = Tools.ZoomImage(imgArray[2], Constant.DRAW_WIDTH, Constant.DRAW_HEIGHT);
            //#else
//#            this.imgArray[2] = ResManager.createImage(90000017);
            //#endif
//#            //确定返回
//#            this.imgArray[3] = ResManager.createImage(90000043);
//#            this.imgArray[4] = ResManager.createImage(90000047);//数字图片
//#        } catch (Exception e) {
//#            if (Constant.DEBUG) {
//#                e.printStackTrace();
//#            }
//#        }
        //#endif
        this.byPageIndex = 1;
        this.byMaxPage = 1;
        if (this.serverInformation.length >= 1) {
            this.iSelectIndex = 1;
            this.byMaxPage = (byte) Tools.ceil(this.serverInformation.length, this.numPerPage);
        } else {
            this.iSelectIndex = -1;
        }


    }
    public static String[][] serverInformation;

    public void getServerInformation(int num, String server_id, String server_nm, String product_id, String status, String server_type, String ip, String port, String authenticationCode1, String authenticationCode2, String character, String player_nm) {
        serverInformation[num][0] = server_id;
        serverInformation[num][1] = server_nm;
        serverInformation[num][2] = product_id;
        serverInformation[num][3] = status;
        serverInformation[num][4] = server_type;
        serverInformation[num][5] = ip;
        serverInformation[num][6] = port;
        serverInformation[num][7] = authenticationCode1;
        serverInformation[num][8] = authenticationCode2;
        serverInformation[num][9] = character;
        serverInformation[num][10] = player_nm;
    }

    public void drawServerList(Graphics g) {
        if (this.imgArray != null) {
            //#if NOKIA_S60V5
             Tools.drawS60V5Frame(g, this.imgArray[2], this.imgArray[7],
                     this.imgArray[6], this.imgArray[4], this.imgArray[5], this.sArray[0]);
             int start_Y = Constant.UI_START_Y + 41;
            //#else
//#            Tools.drawFrame(g,
//#                    Constant.UI_START_X, Constant.UI_START_Y,
//#                    this.imgArray[2],
//#                    this.imgArray[0],
//#                    this.imgArray[1],
//#                    this.imgArray[3],
//#                    0, 0, 24, 12,
//#                    this.imgArray[3], 49, 0, 23, 12,
//#                    this.sArray[0], 0xFFFFFF);
//#            //"选择服务器","服务器","角色数","状态"
//#            int start_Y = Constant.UI_START_Y + 21;
            //#endif
            //#if NOKIA_S40V3 || NORMAL_240_400  || MOTO || K790
//#             if (sArray != null) {
//#                 Tools.drawShadowString(g, (byte) 1, sArray[1], Constant.UI_START_X + 20, start_Y, 0x00E7FF, 0x000000);
//#                 //Tools.drawShadowString(g, (byte) 1, sArray[2], Constant.UI_START_X + (Constant.DRAW_WIDTH - Constant.FONT_SMALL.stringWidth(this.sArray[2]) >> 1), start_Y, 0x00E7FF, 0x000000);
//#                 Tools.drawShadowString(g, (byte) 1, sArray[3], Constant.UI_START_X + Constant.DRAW_WIDTH - 20, start_Y, 0x00E7FF, 0x000000, g.RIGHT | g.TOP);
//#             }
            //#else
            if (sArray != null) {
                Tools.drawShadowString(g, (byte) 1, sArray[1], Constant.UI_START_X + 5, start_Y, 0xffffff, 0x000000);
//                Tools.drawShadowString(g, (byte) 1, sArray[2], Constant.UI_START_X + Constant.DRAW_WIDTH / 2, start_Y, 0xffffff, 0x000000);
                Tools.drawShadowString(g, (byte) 1, sArray[3], Constant.UI_START_X + Constant.DRAW_WIDTH - 5, start_Y, 0xffffff, 0x000000, g.RIGHT | g.TOP);
            }
            //#endif
            start_Y += Constant.FONT_SMALL_HEIGHT + 10;
            int startIndex = (this.byPageIndex - 1) * this.numPerPage;
            int endIndex = this.byPageIndex == this.byMaxPage ? serverInformation.length : this.byPageIndex * this.numPerPage;
            int selectStartY = 0;
            int j = 1;
            for (int i = startIndex; i < endIndex; i++) {
                if (j == this.iSelectIndex) {
                    start_Y = this.drawServerListItem(g, i, true, start_Y);
                    selectStartY = start_Y - 5;
                } else {
                    start_Y = this.drawServerListItem(g, i, false, start_Y);
                }
                j++;
            }
            if (this.iSelectIndex != -1 && this.imgArray != null && this.imgArray[1] != null) {
                Tools.drawSelectMask(g, (byte) 1, this.imgArray[1], Constant.UI_START_X, selectStartY, Constant.DRAW_WIDTH);
            }
            //绘制翻页
            //#if NOKIA_S60V5
             if (this.imgArray != null && this.imgArray[8] != null && this.imgArray[0] != null) {
                 Tools.drawPage(g, byMaxPage, this.byPageIndex, this.imgArray[8], this.imgArray[0], Constant.UI_START_X + (Constant.DRAW_WIDTH - Tools.getPageStrWidth(this.byPageIndex, this.byMaxPage) >> 1), Constant.UI_START_Y + Constant.DRAW_HEIGHT - (57 - 9 >> 1));
             }
            //#else
//#            if (this.imgArray !=null && this.imgArray[4] != null && this.imgArray[0] != null) {
//#                Tools.drawPage(g, byMaxPage, this.byPageIndex, this.imgArray[4], this.imgArray[0], Constant.UI_START_X + (Constant.DRAW_WIDTH - Tools.getPageStrWidth(this.byPageIndex, this.byMaxPage) >> 1), Constant.UI_START_Y + Constant.DRAW_HEIGHT - 21 + (21 - 9 >> 1));
//#            }
            //#endif
        }
    }

    private int drawServerListItem(Graphics g, int index, boolean bSelected, int startY) {
        //绘制服务器名称
        if (index < 0) {
            return startY;
        }
        Tools.drawShadowString(g, (byte) 1, this.serverInformation[index][1], Constant.UI_START_X + 5, startY, 0xFF9900, 0x000000);
        //绘制服务器角色数量
        //Tools.drawShadowString(g, (byte) 1, this.serverInformation[index][9], Constant.UI_START_X + Constant.DRAW_WIDTH / 2 + Constant.FONT_SMALL.stringWidth(sArray[2]) - Constant.FONT_SMALL.stringWidth(this.serverInformation[index][9]), startY, 0xFF9900, 0x000000);
        //绘制服务器状态
        int type = Integer.parseInt(serverInformation[index][4]);
        int color;
        if (type == 0 || type == 1 || type == 2) {
            color = 0xFFFFFF;
        } else {
            color = 0x999999;
        }
        if (sArray != null) {
            Tools.drawShadowString(g, (byte) 1, this.sArray[4 + type], Constant.UI_START_X + Constant.DRAW_WIDTH - 5, startY, color, 0x000000, g.RIGHT | g.TOP);
        }
        return startY + Constant.FONT_SMALL_HEIGHT + 10;
    }

    public void updateServerList() {
        if (GameBean.b_WAIT_NET_MSG_BACK) {
            MainCanvas.clearInput();
            return;
        }
        if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_RIGHT, false)) {
            if (this.byPageIndex < this.byMaxPage) {
                this.iSelectIndex = 1;
                this.byPageIndex += 1;
            }
        } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_LEFT, false)) {
            if (this.byPageIndex > 1) {
                this.iSelectIndex = 1;
                this.byPageIndex -= 1;
            }
        } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_DOWN, false)) {
            if (this.byPageIndex < this.byMaxPage) {
                this.iSelectIndex = iSelectIndex < this.numPerPage ? this.iSelectIndex + 1 : this.numPerPage;
            } else if (this.byPageIndex == this.byMaxPage && this.iSelectIndex != -1) {
                this.iSelectIndex = iSelectIndex + (this.byPageIndex - 1) * this.numPerPage == this.serverInformation.length ? this.iSelectIndex : this.iSelectIndex + 1;
            }
        } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_UP, false)) {
            if (this.iSelectIndex > 1) {
                this.iSelectIndex -= 1;
            }
        } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_POSITIVE, false)
                || MainCanvas.keyPressedLogic(Constant.GAME_KEY_FIRE, false)
                || MainCanvas.keyPressedLogic(Constant.GAME_KEY_5, false)) {
            if (this.iSelectIndex != -1) {
                ResManager.clearRes(Constant.RES_PUBLIC_ONEROOM);
                //判断当前服务器的状态
                if (this.serverInformation[this.iSelectIndex - 1][3].equals("1")) {
                    Tools.makeConnectIP(this.serverInformation[this.iSelectIndex - 1][5], this.serverInformation[this.iSelectIndex - 1][6], Integer.parseInt(this.serverInformation[this.iSelectIndex - 1][7]), Integer.parseInt(this.serverInformation[this.iSelectIndex - 1][8]));
                    GameBean.SERVER_ID = Integer.parseInt(this.serverInformation[this.iSelectIndex - 1][0]);
                    GameBean.b_WAIT_NET_MSG_BACK = true;
                    Rms.saveGame(Constant.RMS_CONNECT_IP, null);
                    Rms.saveGame(Constant.RMS_SOCKET_AUTHCODE1, null);
                    Rms.saveGame(Constant.RMS_SOCKET_AUTHCODE2, null);
                    Rms.saveGame(Constant.RMS_SERVER_ID, null);
                    NetManager.getNewInstance().startNetManager();
                    MainCanvas.clearInput();
                } else {
                    MainLogic.getInstance().uiInterFace.sysMessage.showMessage("提示", "您选择的服务器目前不可用!");
                }
            }
        } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_NEGATIVE, false)) {
            MainLogic.getInstance().pushState(Constant.GAME_UI_LOGIN, true);
        }
        MainCanvas.clearInput();
    }

    public void clearServerList() {
        this.imgArray = null;
        this.sArray = null;
    }

    /**
     * 设置游戏UI状态
     * @param state
     */
    public void setGameUiState(byte state) {
        byUiState = state;
    }

    public void clearUiLogin() {
        sArray = null;
        sStrArray = null;
        imgArray = null;
        imgArray = null;
        iLineConfigArray = null;
        iArray = null;
        animation = null;
        iMenuArray = null;
        sDataArray = null;
    }

    public void initOpenScreen() {
        byUiState = 0;
        iAniCountIndex = 0;
        iArray = new int[]{0, 255, 0, 0};
        sArray = new String[]{"上古时代", "女娲大神炼石补天", "将剩余碎片抛洒人间", "其中一块五色奇石",
            "感天地之灵气", "受万物之孕化", "产生灵性幻化成仙", "跳过"};
        iData = new int[sArray.length][1];
        imgArray = new Image[4];
//        imgArray[0] = Tools.createPicFromGrayscale(ResManager.createImage(90000019), -1);
        imgArray[1] = ResManager.createImage(90000075);//片头1图片
        imgArray[2] = ResManager.createImage(90000076);//片头2图片
        imgArray[3] = Tools.makeTransparent(imgArray[1], iArray[0]);
    }

    public void drawOpenScreen(Graphics g) {
//        Tools.drawCorner(g, Constant.UI_START_X, Constant.UI_START_Y, this.imgArray[0]);
        //#if NOKIA_S60V5
         h = Constant.FONT_SMALL_HEIGHT + 20;
        //#else
//#        h = Constant.FONT_SMALL_HEIGHT;
        //#endif
        switch (byUiState) {
            case 1:
                g.drawRegion(imgArray[3], 0, iArray[2], Constant.DRAW_WIDTH, Constant.DRAW_HEIGHT, Constant.TRANS_NONE,
                        Constant.UI_START_X, Constant.UI_START_Y, 0);
                if (iArray[1] == 255) {
                    for (int i = 0; i <= iArray[3]; i++) {
                        g.setClip(Constant.UI_START_X + (Constant.DRAW_WIDTH - Constant.FONT_SMALL.stringWidth(sArray[2]) >> 1) - 2,
                                Constant.UI_START_Y + (Constant.DRAW_HEIGHT - h * (sArray.length - 1) >> 1) + h * i,
                                iData[i][0], h);
                        Tools.drawShadowString(g, (byte) 1, sArray[i],
                                Constant.UI_START_X + (Constant.DRAW_WIDTH - Constant.FONT_SMALL.stringWidth(sArray[2]) >> 1),
                                Constant.UI_START_Y + (Constant.DRAW_HEIGHT - h * (sArray.length - 1) >> 1) + h * i,
                                0xFFFFFF, 0x000000);
                    }
                }
                break;
            case 2:
                g.drawRegion(imgArray[3], 0, iArray[2], Constant.DRAW_WIDTH, Constant.DRAW_HEIGHT, Constant.TRANS_NONE,
                        Constant.UI_START_X, Constant.UI_START_Y, 0);
                if (iArray[1] == 255) {
                    for (int i = 0; i <= iArray[3]; i++) {
                        g.setClip(Constant.UI_START_X + (Constant.DRAW_WIDTH - Constant.FONT_SMALL.stringWidth(sArray[3]) >> 1) - 2,
                                Constant.UI_START_Y + (Constant.DRAW_HEIGHT - h * (sArray.length - 1) >> 1) + h * i,
                                iData[i][0], h);
                        Tools.drawShadowString(g, (byte) 1, sArray[i],
                                Constant.UI_START_X + (Constant.DRAW_WIDTH - Constant.FONT_SMALL.stringWidth(sArray[3]) >> 1),
                                Constant.UI_START_Y + (Constant.DRAW_HEIGHT - h * (sArray.length - 1) >> 1) + h * i,
                                0xFFFFFF, 0x000000);
                    }
                }
                break;
        }
        g.setClip(Constant.UI_START_X, Constant.UI_START_Y, Constant.DRAW_WIDTH, Constant.DRAW_HEIGHT);
        if (byUiState > 0) {
            Tools.drawShadowString(g, (byte) 1, sArray[sArray.length - 1],
                    Constant.UI_START_X + Constant.DRAW_WIDTH - Constant.FONT_SMALL.stringWidth(sArray[sArray.length - 1]) - 10,
                    Constant.UI_START_Y + Constant.DRAW_HEIGHT - 10 - h + (h - Constant.FONT_SMALL_HEIGHT >> 1),
                    0x00CCFF, 0x000000);
        }
    }

    public void updateOpenScreen() {
        switch (byUiState) {
            case 0:
                iAniCountIndex++;
                if (iAniCountIndex >= 5) {
                    byUiState = 1;
                    iAniCountIndex = 0;
                }
                break;
            case 1://片头1
                if (iArray[2] < 30) {
                    iAniCountIndex++;
                    if (iAniCountIndex == 3) {
                        iArray[2]++;
                        iAniCountIndex = 0;
                    }
                }
                if (iArray[3] < sArray.length - 1) {
                    iData[iArray[3]][0] += 8;
                    if (iData[iArray[3]][0] > Constant.FONT_SMALL.stringWidth(sArray[iArray[3]])) {
                        iArray[3]++;
                    }
                }
                if (iArray[0] < 255) {//由无到有
                    iArray[0] = iArray[0] + 10 > 255 ? 255 : iArray[0] + 10;
                    imgArray[3] = Tools.makeTransparent(imgArray[1], iArray[0]);
                } else if (iArray[2] >= 30) {
                    if (iArray[3] >= sArray.length - 1) {
                        iArray[1] = iArray[1] - 30 > 0 ? iArray[1] - 30 : 0;
                        imgArray[3] = Tools.makeTransparent(imgArray[1], iArray[1]);
                        if (iArray[1] == 0) {
                            byUiState = 2;
                            iArray = new int[]{0, 255, 0, 0};
                            sArray = new String[]{
                                "炎黄大败蚩尤之后", "将其抛尸大荒山", "数百年后", "蚩尤的秘密被邪教利用", "猛兽四出，妖物横行",
                                "天下动荡不安", "五色奇石受到女娲召唤", "降临人间拯救苍生", "跳过"};
                            iData = new int[sArray.length][1];
                        }
                    }
                }
                if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_NEGATIVE, false)) {
                    byUiState = 2;
                    iArray = new int[]{0, 255, 0, 0};
                    sArray = new String[]{
                        "炎黄大败蚩尤之后", "将其抛尸大荒山", "数百年后", "蚩尤的秘密被邪教利用", "猛兽四出，妖物横行",
                        "天下动荡不安", "五色奇石受到女娲召唤", "降临人间拯救苍生", "跳过"};
                    iData = new int[sArray.length][1];
                }
                break;
            case 2://片头2
                if (iArray[2] < 30) {
                    iAniCountIndex++;
                    if (iAniCountIndex == 3) {
                        iArray[2]++;
                        iAniCountIndex = 0;
                    }
                }
                if (iArray[3] < sArray.length - 1) {
                    iData[iArray[3]][0] += 9;
                    if (iData[iArray[3]][0] > Constant.FONT_SMALL.stringWidth(sArray[iArray[3]])) {
                        iArray[3]++;
                    }
                }
                if (iArray[0] < 255) {//由无到有
                    iArray[0] = iArray[0] + 10 > 255 ? 255 : iArray[0] + 10;
                    imgArray[3] = Tools.makeTransparent(imgArray[2], iArray[0]);
                } else if (iArray[2] >= 30) {
                    if (iArray[3] >= sArray.length - 1) {
                        iArray[1] = iArray[1] - 30 > 0 ? iArray[1] - 30 : 0;
                        imgArray[3] = Tools.makeTransparent(imgArray[2], iArray[1]);
                        if (iArray[1] == 0) {
                            MainLogic.pushState(Constant.GAME_UI_ROAM, false);
                        }
                    }
                }
                if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_NEGATIVE, false)) {
                    MainLogic.pushState(Constant.GAME_UI_ROAM, false);
                }
                break;
        }
    }

    public void clearOpenScreen() {
        imgArray = null;
        sArray = null;
        iArray = null;
        iData = null;
    }

    /*****************************游戏帮助***************************************/
    public void initHelp() {
        //#if NOKIA_S60V5
         imgArray = new Image[5];
         imgArray[0] = Tools.makeBlueMask();//蓝色光片
         imgArray[1] = ResManager.createImage(90000017);//背景图片
         imgArray[2] = Tools.makeTransparent(Constant.DRAW_WIDTH, 10, 150, 0x232323);//半透背景图片
         imgArray[3] = ResManager.createImage(90000043);//确定、返回图片
         imgArray[4] = ResManager.createImage(90000086);//底部蓝条
         sData = new String[][]{
        	{"联系客服", "客服电话：暂无", "客服QQ：暂无", "客服邮箱：暂无", "官方微博：", "暂无", "暂无", "官方网站：", "暂无"},
             {"版权信息", "demo", "游戏版本：V1.0.0"},
             {"游戏帮助"}};
//         sData = new String[][]{{"联系客服", "客服电话：010-64446651", "客服QQ：1780208942", "客服邮箱：mello_co@163.com", "官方微博：", "http://weibo.com/shenyiol", "http://weibo.cn/shenyiol", "官方网站：", "http://www.keetaa.com"},
//        		 {"版权信息", "亿门楼游戏版权所有", "游戏版本：V1.0.0"}, {"游戏帮助"}};
         h = (Constant.END_LINE - 41) / 14;
        //#else
//#        imgArray = new Image[4];
//#        imgArray[0] = Tools.makeBlueMask();//蓝色光片
        //#if NORMAL_240_400
//#         imgArray[1] = ResManager.createImage(90000017);
//#         imgArray[1] = Tools.ZoomImage(imgArray[1], Constant.DRAW_WIDTH, Constant.DRAW_HEIGHT);
        //#else
//#        imgArray[1] = ResManager.createImage(90000017);//背景图片
        //#endif
//#        imgArray[2] = Tools.makeTransparent(Constant.DRAW_WIDTH, 10, 150, 0x232323);//半透背景图片
//#        imgArray[3] = ResManager.createImage(90000043);//确定、返回图片
//#        sData = new String[][]{{"联系客服", "客服电话：010-64446651", "客服QQ：1780208942", "客服邮箱：mello_co@163.com", "官方微博：", "http://weibo.com/shenyiol", "http://weibo.cn/shenyiol", "官方网站：", "http://www.keetaa.com"},
//#            {"版权信息", "亿门楼游戏版权所有", "游戏版本：V1.0.0"}};
//#        h = Constant.FONT_SMALL_HEIGHT;
        //#endif
    }

    public void drawHelp(Graphics g) {
        startX = Constant.UI_START_X + 0;
        startY = Constant.UI_START_Y + 0;
        //#if NOKIA_S60V5
         //绘制背景
         Tools.drawS60V5Frame(g, imgArray[1], null, null, imgArray[4], imgArray[3], sData[2][0]);
         //绘制联系客服
         startY = Constant.UI_START_Y + 41 + (h - Constant.FONT_SMALL_HEIGHT >> 1);
         for (int i = 0; i < sData[0].length; i++) {
             startX = Constant.UI_START_X + (Constant.DRAW_WIDTH - Constant.FONT_SMALL.stringWidth(sData[0][i]) >> 1);
             Tools.drawShadowString(g, (byte) 1, sData[0][i], startX, startY, i == 0 ? selectColor : whiteColor, blackColor);
             startY += h;
         }
         //绘制版权信息
         startX = Constant.UI_START_X + (Constant.DRAW_WIDTH - Constant.FONT_SMALL.stringWidth(sData[1][0]) >> 1);
         Tools.drawShadowString(g, (byte) 1, sData[1][0], startX, startY, selectColor, blackColor);
         startY += h;
         startX = Constant.UI_START_X + (Constant.DRAW_WIDTH - Constant.FONT_SMALL.stringWidth(sData[1][1]) >> 1);
         Tools.drawShadowString(g, (byte) 1, sData[1][1], startX, startY, whiteColor, blackColor);
         startX = Constant.UI_START_X + (Constant.DRAW_WIDTH - Constant.FONT_SMALL.stringWidth(sData[0][2]) >> 1);
         startY = Constant.UI_START_Y + Constant.DRAW_HEIGHT - 58 + (58 - Constant.FONT_SMALL_HEIGHT >> 1);
         Tools.drawShadowString(g, (byte) 1, sData[1][2], startX, startY, whiteColor, blackColor);
        //#else
//#        //绘制背景
//#        g.drawImage(imgArray[1], startX, startY, 0);
//#        Tools.drawTilePic(g, (byte) 2, startX, startY, Constant.DRAW_HEIGHT, imgArray[2], 0, 0, Constant.DRAW_WIDTH,
//#                imgArray[2].getHeight(), Constant.TRANS_NONE);
//#        Tools.drawSelectMask(g, (byte) 2, imgArray[0], startX, startY + Constant.DRAW_HEIGHT - 30, Constant.DRAW_WIDTH,
//#                null, imgArray[3], 0, 0, 24, 12, imgArray[3], 49, 0, 23, 12);
//#        //绘制联系客服
//#        startY = Constant.UI_START_Y;
//#        for (int i = 0; i < sData[0].length; i++) {
//#            if (i == 0) {
//#                startX = Constant.UI_START_X + (Constant.DRAW_WIDTH - Constant.FONT_SMALL.stringWidth(sData[0][i]) >> 1);
//#            } else {
//#                startX = Constant.UI_START_X;
//#            }
//#            Tools.drawShadowString(g, (byte) 1, sData[0][i], startX, startY + h * i, i == 0 ? selectColor : whiteColor, blackColor);
//#        }
//#        //绘制版权信息
//#        startY = Constant.UI_START_Y + h * sData[0].length;
//#        startX = Constant.UI_START_X + (Constant.DRAW_WIDTH - Constant.FONT_SMALL.stringWidth(sData[1][0]) >> 1);
//#        Tools.drawShadowString(g, (byte) 1, sData[1][0], startX, startY, selectColor, blackColor);
//#        startX = Constant.UI_START_X + (Constant.DRAW_WIDTH - Constant.FONT_SMALL.stringWidth(sData[1][1]) >> 1);
//#        Tools.drawShadowString(g, (byte) 1, sData[1][1], startX, startY + h, whiteColor, blackColor);
//#        startX = Constant.UI_START_X + (Constant.DRAW_WIDTH - Constant.FONT_SMALL.stringWidth(sData[1][2]) >> 1);
//#        startY = Constant.UI_START_Y + Constant.DRAW_HEIGHT - 30 + (30 - Constant.FONT_SMALL_HEIGHT >> 1);
//#        Tools.drawShadowString(g, (byte) 1, sData[1][2], startX, startY, whiteColor, blackColor);
        //#endif
    }

    public void updateHelp() {
        if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_POSITIVE, false)
                || MainCanvas.keyPressedLogic(Constant.GAME_KEY_NEGATIVE, false)) {//返回上一界面
//            MainLogic.getInstance().playerFightLogic(Constant.GAME_UI_OPTION_LIST, true);
            MainLogic.getInstance().pushState(Constant.GAME_UI_OPTION_LIST, true);
        }
    }

    public void clearHelp() {
        sData = null;
        imgArray = null;
    }

    /**********************************游戏关于*************************************/
    public void initAbout() {
        //#if NOKIA_S60V5
         sData = new String[][]{{"神羿制作组", "暂无"},
             {"出品人（Producer）", "暂无"},
             {"策划组（Game Designer）", "暂无"},
             {"美术组（Game Art）", "暂无"},
             {"服务器（Server）", "暂无"},
             {"客户端（Client）", "暂无"},
             {"运营组（Operations）", "暂无"},
             {"感谢您的游玩！"},
             {"游戏关于"}};
         h = (Constant.END_LINE - 41) / 14;
         imgArray = new Image[5];
         imgArray[0] = Tools.makeBlueMask();//蓝色光片
         imgArray[1] = ResManager.createImage(90000017);//背景图片
         imgArray[2] = Tools.makeTransparent(Constant.DRAW_WIDTH, 10, 150, 0x232323);//半透背景图片
         imgArray[3] = ResManager.createImage(90000043);//确定、返回图片
         imgArray[4] = ResManager.createImage(90000086);//底部蓝条
        //#else
//#        sData = new String[][]{{"神羿制作组", "KEETAA Team 2010-2011"},
//#            {"出品人（Producer）", "老廖"},
//#            {"策划组（Game Designer）", "猫兔兔 立春 稻草人 独鹿"},
//#            {"美术组（Game Art）", "Ijiloart HY Crow ", "Crazy 虫子 爱已封存"},
//#            {"服务器（Server）", "勇哥 刚哥 点儿"},
//#            {"客户端（Client）", "龙香 代码哥 逗你玩儿 罪人"},
//#            {"运营组（Operations）", "Rico Amos AR SZ Fiona"},
//#            {"感谢您的游玩！"}};
//#        h = Constant.FONT_SMALL_HEIGHT;
//#        offy = 0;
//#        imgArray = new Image[4];
//#        imgArray[0] = Tools.makeBlueMask();//蓝色光片
        //#if NORMAL_240_400
//#         imgArray[1] = ResManager.createImage(90000017);
//#         imgArray[1] = Tools.ZoomImage(imgArray[1], Constant.DRAW_WIDTH, Constant.DRAW_HEIGHT);
        //#else
//#        imgArray[1] = ResManager.createImage(90000017);//背景图片
        //#endif
//#        imgArray[2] = Tools.makeTransparent(Constant.DRAW_WIDTH, 10, 150, 0x232323);//半透背景图片
//#        imgArray[3] = ResManager.createImage(90000043);//确定、返回图片
        //#endif
    }

    public void drawAbout(Graphics g) {
        startX = Constant.UI_START_X + 0;
        startY = Constant.UI_START_Y + 0;
        //#if NOKIA_S60V5
         //绘制背景
         Tools.drawS60V5Frame(g, imgArray[1], null, null, imgArray[4], imgArray[3], sData[8][0]);
         //绘制感谢您的游玩
         startX = Constant.UI_START_X + (Constant.DRAW_WIDTH - Constant.FONT_SMALL.stringWidth(sData[7][0]) >> 1);
         startY = Constant.UI_START_Y + Constant.DRAW_HEIGHT - 58 + (58 - Constant.FONT_SMALL_HEIGHT >> 1);
         Tools.drawShadowString(g, (byte) 1, sData[7][0], startX, startY, whiteColor, blackColor);
         //绘制内容
         startY = Constant.UI_START_Y + 41 + (h - Constant.FONT_SMALL_HEIGHT >> 1);
         for (int i = 0; i < 7; i++) {
             for (int j = 0; j < sData[i].length; j++) {
                 if (j == 0) {
                     g.setColor(0x666666);
                     g.drawLine(Constant.UI_START_X, startY - (h - Constant.FONT_SMALL_HEIGHT >> 1),
                             Constant.UI_START_X + Constant.DRAW_WIDTH, startY - (h - Constant.FONT_SMALL_HEIGHT >> 1));
                 }
                 startX = Constant.UI_START_X + (Constant.DRAW_WIDTH - Constant.FONT_SMALL.stringWidth(sData[i][j]) >> 1);
                 Tools.drawShadowString(g, (byte) 1, sData[i][j], startX, startY, j == 0 ? selectColor : whiteColor, blackColor);
                 startY += h;
             }
         }
        //#else
//#        //绘制背景
//#        g.drawImage(imgArray[1], startX, startY, 0);
//#        Tools.drawTilePic(g, (byte) 2, startX, startY, Constant.DRAW_HEIGHT, imgArray[2], 0, 0, Constant.DRAW_WIDTH,
//#                imgArray[2].getHeight(), Constant.TRANS_NONE);
//#        Tools.drawSelectMask(g, (byte) 2, imgArray[0], startX, startY + Constant.DRAW_HEIGHT - 30, Constant.DRAW_WIDTH,
//#                null, imgArray[3], 0, 0, 24, 12, imgArray[3], 49, 0, 23, 12);
//#        //绘制感谢您的游玩
//#        startX = Constant.UI_START_X + (Constant.DRAW_WIDTH - Constant.FONT_SMALL.stringWidth(sData[7][0]) >> 1);
//#        startY = Constant.UI_START_Y + Constant.DRAW_HEIGHT - 30 + (30 - Constant.FONT_SMALL_HEIGHT >> 1);
//#        Tools.drawShadowString(g, (byte) 1, sData[7][0], startX, startY, whiteColor, blackColor);
//#        //绘制内容
//#        startY = Constant.UI_START_Y;
//#        for (int i = 0; i < 7; i++) {
//#            g.setClip(0, 0, Constant.DRAW_WIDTH, Constant.DRAW_HEIGHT - 30);
//#            for (int j = 0; j < sData[i].length; j++) {
//#                if (j == 0) {
//#                    g.setColor(0x666666);
//#                    g.drawLine(Constant.UI_START_X, startY + offy, Constant.UI_START_X + Constant.DRAW_WIDTH, startY + offy);
//#                }
//#                startX = Constant.UI_START_X + (Constant.DRAW_WIDTH - Constant.FONT_SMALL.stringWidth(sData[i][j]) >> 1);
//#                Tools.drawShadowString(g, (byte) 1, sData[i][j], startX, startY + offy, j == 0 ? selectColor : whiteColor, blackColor);
//#                startY += h;
//#            }
//#        }
        //#endif
    }

    public void updateAbout() {
        if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_POSITIVE, false)
                || MainCanvas.keyPressedLogic(Constant.GAME_KEY_NEGATIVE, false)) {//返回上一界面
//            MainLogic.getInstance().playerFightLogic(Constant.GAME_UI_OPTION_LIST, true);
            MainLogic.getInstance().pushState(Constant.GAME_UI_OPTION_LIST, true);
        } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_UP, false)) {
            offy = 0;
        } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_DOWN, false)) {
            if (offy == 0) {
                int temp = 0;
                for (int i = 0; i < sData.length; i++) {
                    for (int j = 0; j < sData[i].length; j++) {
                        temp++;
                    }
                }
                offy = Constant.DRAW_HEIGHT - 30 - h * (temp - 1);
                if (offy > 0) {
                    offy = 0;
                }
            }
        }
    }

    public void clearAbout() {
        imgArray = null;
        sData = null;
    }

    /************************************游戏设置**************************************/
    public void initSet() {
        bUiKeyPressLock = false;
        bySelectIndex = 1;
        this.byUiState = 0;
        GameBean.BY_PRE_GAME_UI_STATE = Constant.GAME_UI_SET;
        sArray = new String[]{"游戏设置", "1 密码修改", "2 音乐"};//, "3 修复游戏"};
        sStrArray = new String[]{"开", "关", "联网设置", "移动梦网", "GPRS", "使用移动梦网连接方式进入游戏，适用于移动梦网模式", "使用GPRS连接方式进入游戏，使用于GRPS模式", "当前使用"};
        //#if NOKIA_S60V5
         h = Constant.FONT_SMALL_HEIGHT + 10;
         iPositionY = Constant.UI_START_Y + ((Constant.DRAW_HEIGHT - 41 - 58) - (sArray.length - 1) * h >> 1);
         imgArray = new Image[7];
         imgArray[0] = Tools.makeBlueMask();//蓝色光片
         imgArray[1] = ResManager.createImage(90000017);//背景图片
         imgArray[2] = Tools.makeTransparent(Constant.DRAW_WIDTH, 10, 150, 0x232323);//半透背景图片
         imgArray[3] = ResManager.createImage(90000043);//确定、返回图片
         imgArray[4] = ResManager.createImage(90000084);//方向键
         imgArray[5] = ResManager.createImage(90000085);//确定键
         imgArray[6] = ResManager.createImage(90000086);//底部蓝条
        //#else
//#        h = Constant.FONT_SMALL_HEIGHT;
//#        iPositionY = Constant.UI_START_Y + ((Constant.DRAW_HEIGHT - 21 - 25) - (sArray.length - 1) * h >> 1);
//#        imgArray = new Image[4];
//#        imgArray[0] = Tools.makeBlueMask();//蓝色光片
        //#if NOKIA_S40V3  || MOTO || K790
        //#elif NORMAL_240_400
//# //        imgArray[1] = ResManager.createImage(90000017);
//# //        imgArray[1] = Tools.ZoomImage(imgArray[1], Constant.DRAW_WIDTH, Constant.DRAW_HEIGHT);
        //#else
//#        imgArray[1] = ResManager.createImage(90000017);//背景图片
        //#endif
//#        imgArray[2] = Tools.makeTransparent(Constant.DRAW_WIDTH, 10, 150, 0x232323);//半透背景图片
//#        imgArray[3] = ResManager.createImage(90000043);//确定、返回图片
        //#endif
    }

    public void drawSet(Graphics g) {
        switch (this.byUiState) {
            case 0://游戏设置界面
                startX = Constant.UI_START_X + 0;
                startY = Constant.UI_START_Y + 0;
                //#if NOKIA_S60V5
                 Tools.drawS60V5Frame(g, imgArray[1], imgArray[4], imgArray[5], imgArray[6], imgArray[3], sArray[0]);
                 startY = Constant.UI_START_Y + ((Constant.DRAW_HEIGHT - 41 - 58) - (sArray.length - 1) * h >> 1)
                         + (h - Constant.FONT_SMALL_HEIGHT >> 1);
                //#else
//#                Tools.drawFrame(g, startX, startY, imgArray[1], null, imgArray[0],
//#                        imgArray[3], 0, 0, 24, 12, imgArray[3], 49, 0, 23, 12, sArray[0], selectColor);
//#                startY = Constant.UI_START_Y + ((Constant.DRAW_HEIGHT - 21 - 25) - (sArray.length - 1) * h >> 1)
//#                        + (h - Constant.FONT_SMALL_HEIGHT >> 1);
                //#endif
                startX = Constant.UI_START_X + (Constant.DRAW_WIDTH - Constant.FONT_SMALL.stringWidth(sArray[1]) >> 1);
                for (int i = 0; i < sArray.length - 1; i++) {
                    Tools.drawShadowString(g, (byte) 1, sArray[i + 1], startX, startY,
                            i == bySelectIndex - 1 ? selectColor : whiteColor, blackColor);
                    if (i == 1) {
                        Tools.drawShadowString(g, (byte) 1, UiInterFace.SetPlayMusic ? sStrArray[0] : sStrArray[1],
                                startX + Constant.FONT_SMALL.stringWidth(sArray[1] + sStrArray[0]), startY,
                                bySelectIndex - 1 == 1 ? selectColor : whiteColor, blackColor);
                    }
                    startY += h;
                }
                startX = Constant.UI_START_X + 0;
                Tools.drawGapSlectMask(g, imgArray[0], null, false, h, startX, iPositionY, Constant.DRAW_WIDTH);
                break;
            case 1://密码修改
                break;
            case 2://联网设置
                //#if NOKIA_S60V5
                 Tools.drawS60V5Frame(g, imgArray[1], imgArray[4], imgArray[5], imgArray[6], imgArray[3], sStrArray[2]);
                 Tools.drawShadowString(g, (byte) 1, this.sStrArray[4], Constant.UI_START_X + 20, Constant.UI_START_Y + 50, this.bySelectIndex == 1 ? selectColor : whiteColor, blackColor);
                 Tools.drawShadowString(g, (byte) 1, this.sStrArray[3], Constant.UI_START_X + 20, Constant.UI_START_Y + 50 + Constant.FONT_SMALL_HEIGHT + 5, this.bySelectIndex == 2 ? selectColor : whiteColor, blackColor);
//                 if (GameBean.BY_NET_CONNECT != -1) {
//                     Tools.drawShadowString(g, (byte) 1, this.sStrArray[7], Constant.UI_START_X + Constant.DRAW_WIDTH - 20, Constant.UI_START_Y + 50 + (GameBean.BY_NET_CONNECT - 1) * (Constant.FONT_SMALL_HEIGHT + 5), 0x00ff00, blackColor, g.RIGHT | g.TOP);
//                 }
                 Tools.drawParagraph(g, Constant.UI_START_X + 10, Constant.UI_START_Y + 60 + (Constant.FONT_SMALL_HEIGHT + 5) * 2, Constant.DRAW_WIDTH - 20, this.bySelectIndex == 1 ? this.sStrArray[5] : this.sStrArray[6], 0xFFFFFF, Constant.FONT_SMALL_HEIGHT + 1, 0x000000);
                 Tools.drawSelectMask(g, (byte) 1, imgArray[0], Constant.UI_START_X, Constant.UI_START_Y + 48 + (Constant.FONT_SMALL_HEIGHT + 5) * this.bySelectIndex, Constant.DRAW_WIDTH);
                //#else
//#                Tools.drawFrame(g, Constant.UI_START_X, Constant.UI_START_Y, imgArray[1], null, imgArray[0],
//#                        imgArray[3], 0, 0, 24, 12, imgArray[3], 49, 0, 23, 12, sStrArray[2], selectColor);
//#                Tools.drawShadowString(g, (byte) 1, this.sStrArray[3], Constant.UI_START_X + 20, Constant.UI_START_Y + 30, this.bySelectIndex == 1 ? selectColor : whiteColor, blackColor);
//#                Tools.drawShadowString(g, (byte) 1, this.sStrArray[4], Constant.UI_START_X + 20, Constant.UI_START_Y + 30 + Constant.FONT_SMALL_HEIGHT + 5, this.bySelectIndex == 2 ? selectColor : whiteColor, blackColor);
//#                if (GameBean.BY_NET_CONNECT != -1) {
//#                    Tools.drawShadowString(g, (byte) 1, this.sStrArray[7], Constant.UI_START_X + Constant.DRAW_WIDTH - 20, Constant.UI_START_Y + 30 + (GameBean.BY_NET_CONNECT - 1) * (Constant.FONT_SMALL_HEIGHT + 5), 0x00ff00, blackColor, g.RIGHT | g.TOP);
//#                }
//#                Tools.drawParagraph(g, Constant.UI_START_X + 10, Constant.UI_START_Y + 40 + (Constant.FONT_SMALL_HEIGHT + 5) * 2, Constant.DRAW_WIDTH - 20, this.bySelectIndex == 1 ? this.sStrArray[5] : this.sStrArray[6], 0xFFFFFF, Constant.FONT_SMALL_HEIGHT + 1, 0x000000);
//#                Tools.drawSelectMask(g, (byte) 1, imgArray[0], Constant.UI_START_X, Constant.UI_START_Y + 28 + (Constant.FONT_SMALL_HEIGHT + 5) * this.bySelectIndex, Constant.DRAW_WIDTH);
                //#endif
//
                break;
        }
    }

    public void updateSet() {
        switch (this.byUiState) {
            case 0:
                if (!bUiKeyPressLock) {
                    if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_UP, false)) {
                        bUiKeyPressLock = true;
                        bySelectIndex = (byte) (bySelectIndex == 1 ? sArray.length - 1 : bySelectIndex - 1);
                        //#if NOKIA_S60V5
                         startY = Constant.UI_START_Y + ((Constant.DRAW_HEIGHT - 41 - 58) - (sArray.length - 1) * h >> 1)
                                 + (bySelectIndex - 1) * h;
                        //#else
//#                        startY = Constant.UI_START_Y + ((Constant.DRAW_HEIGHT - 21 - 25) - (sArray.length - 1) * h >> 1)
//#                                + (bySelectIndex - 1) * h;
                        //#endif
                        iArray = new int[]{2, 1, startY, 2, 50, 5};
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_DOWN, false)) {
                        bUiKeyPressLock = true;
                        bySelectIndex = (byte) (bySelectIndex == sArray.length - 1 ? 1 : bySelectIndex + 1);
                        //#if NOKIA_S60V5
                         startY = Constant.UI_START_Y + ((Constant.DRAW_HEIGHT - 41 - 58) - (sArray.length - 1) * h >> 1)
                                 + (bySelectIndex - 1) * h;
                        //#else
//#                        startY = Constant.UI_START_Y + ((Constant.DRAW_HEIGHT - 21 - 25) - (sArray.length - 1) * h >> 1)
//#                                + (bySelectIndex - 1) * h;
                        //#endif
                        iArray = new int[]{1, 1, startY, 2, 50, 5};
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_1, false)) {
                        bUiKeyPressLock = true;
                        if (bySelectIndex == 1) {
                            return;
                        } else {
                            int temp = bySelectIndex > 1 ? 2 : 1;
                            bySelectIndex = 1;
                            //#if NOKIA_S60V5
                             startY = Constant.UI_START_Y + ((Constant.DRAW_HEIGHT - 41 - 58) - (sArray.length - 1) * h >> 1)
                                     + (bySelectIndex - 1) * h;
                            //#else
//#                            startY = Constant.UI_START_Y + ((Constant.DRAW_HEIGHT - 21 - 25) - (sArray.length - 1) * h >> 1)
//#                                    + (bySelectIndex - 1) * h;
                            //#endif
                            iArray = new int[]{temp, 1, startY, 2, 50, 5};
                        }
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_2, false)) {
                        bUiKeyPressLock = true;
                        if (bySelectIndex == 2) {
                            return;
                        } else {
                            int temp = bySelectIndex > 2 ? 2 : 1;
                            bySelectIndex = 2;
                            //#if NOKIA_S60V5
                             startY = Constant.UI_START_Y + ((Constant.DRAW_HEIGHT - 41 - 58) - (sArray.length - 1) * h >> 1)
                                     + (bySelectIndex - 1) * h;
                            //#else
//#                            startY = Constant.UI_START_Y + ((Constant.DRAW_HEIGHT - 21 - 25) - (sArray.length - 1) * h >> 1)
//#                                    + (bySelectIndex - 1) * h;
                            //#endif
                            iArray = new int[]{temp, 1, startY, 2, 50, 5};
                        }
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_3, false)) {
                        bUiKeyPressLock = true;
                        if (bySelectIndex == 3) {
                            return;
                        } else {
                            int temp = bySelectIndex > 3 ? 2 : 1;
                            bySelectIndex = 3;
                            //#if NOKIA_S60V5
                             startY = Constant.UI_START_Y + ((Constant.DRAW_HEIGHT - 41 - 58) - (sArray.length - 1) * h >> 1)
                                     + (bySelectIndex - 1) * h;
                            //#else
//#                            startY = Constant.UI_START_Y + ((Constant.DRAW_HEIGHT - 21 - 25) - (sArray.length - 1) * h >> 1)
//#                                    + (bySelectIndex - 1) * h;
                            //#endif
                            iArray = new int[]{temp, 1, startY, 2, 50, 5};
                        }
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_4, false)) {
                        bUiKeyPressLock = true;
                        if (bySelectIndex == 4) {
                            return;
                        } else {
                            int temp = bySelectIndex > 4 ? 2 : 1;
                            bySelectIndex = 4;
                            //#if NOKIA_S60V5
                             startY = Constant.UI_START_Y + ((Constant.DRAW_HEIGHT - 41 - 58) - (sArray.length - 1) * h >> 1)
                                     + (bySelectIndex - 1) * h;
                            //#else
//#                            startY = Constant.UI_START_Y + ((Constant.DRAW_HEIGHT - 21 - 25) - (sArray.length - 1) * h >> 1)
//#                                    + (bySelectIndex - 1) * h;
                            //#endif
                            iArray = new int[]{temp, 1, startY, 2, 50, 5};
                        }
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_POSITIVE, false)
                            || (MainCanvas.keyPressedLogic(Constant.GAME_KEY_FIRE, false))) {
                        switch (bySelectIndex) {
                            case 1://密码修改
                                MainLogic.inputInterFace.setInputInterFace((byte) 1, "修改密码");
                                this.byUiState = 1;
                                MainGame.changeCanvas(MainLogic.inputInterFace);
                                break;
//                            case 2://联网设置
//                                this.byUiState = 2;
//                                this.bySelectIndex = 1;
//                                if (!Rms.loadGame(Constant.RMS_PLAYER_NETWORK)) {
//                                    GameBean.BY_NET_CONNECT = -1;
//                                }
//                                //MainLogic.inputInterFace.setInputInterFace((byte) 2, "联网设置");
//                                //MainGame.changeCanvas(MainLogic.inputInterFace);
//                                break;
                            case 2://音乐开关
                                if (MainLogic.getInstance().uiInterFace.isOpenSound) {
                                    //#if NOKIAN73 || NOKIA_S40V3 || NORMAL_240_400  || MOTO || K790
                                    //#else
                                    if (UiInterFace.SetPlayMusic) {
                                        UiInterFace.SetPlayMusic = false;
                                        SoundPlayerUtil.stopAllMusic();
                                        UiInterFace.firstUiMusic = false;
                                    } else {
                                        SoundPlayerUtil.stopAllMusic();
                                        UiInterFace.SetPlayMusic = true;
                                        SoundPlayerUtil.playmusic(0);
                                        UiInterFace.firstUiMusic = false;
                                    }
                                    //#endif
                                }
                                break;
                            case 3://修复游戏
                                break;
                        }
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_NEGATIVE, false)) {
//                MainLogic.getInstance().playerFightLogic(Constant.GAME_UI_OPTION_LIST, true);
                        MainLogic.getInstance().pushState(Constant.GAME_UI_OPTION_LIST, true);
                    }

                } else {
                    iPositionY = Tools.updateLinePos(iArray, iPositionY);
                    if (iArray == null || iArray[1] == 0) {
                        bUiKeyPressLock = false;
                    }
                }
                break;
            case 1://密码修改
                break;
            case 2://联网设置
                if (!bUiKeyPressLock) {
                    if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_UP, false)) {
                        bySelectIndex = (byte) (bySelectIndex == 1 ? 2 : 1);
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_DOWN, false)) {
                        bySelectIndex = (byte) (bySelectIndex == 1 ? 2 : 1);
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_POSITIVE, false)
                            || (MainCanvas.keyPressedLogic(Constant.GAME_KEY_FIRE, false))) {
//                        GameBean.BY_NET_CONNECT = bySelectIndex;
                        Rms.saveGame(Constant.RMS_PLAYER_NETWORK, null);
                        MainLogic.getInstance().uiInterFace.sysMessage.showMessage("提示", "联网方式设置成功!");
                    } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_NEGATIVE, false)) {
                        if (GameBean.BY_PRE_GAME_UI_STATE == Constant.GAME_UI_SET) {
                            this.byUiState = 0;
                        } else {
                            MainLogic.getInstance().pushState(Constant.GAME_UI_OPTION_LIST, true);
                        }
                    }
                } else {
                    iPositionY = Tools.updateLinePos(iArray, iPositionY);
                    if (iArray == null || iArray[1] == 0) {
                        bUiKeyPressLock = false;
                    }
                }
                break;
        }
        MainCanvas.clearInput();
    }

    public void clearSet() {
        imgArray = null;
        sArray = null;
        sStrArray = null;
        GameBean.BY_PRE_GAME_UI_STATE = -1;
    }

    /**
     * 游戏更新界面
     */
    public void initUpdate() {
        sArray = new String[]{"请下载最新游戏包", "神羿制作组感谢您", "的游玩。点击确定", "按钮下载，点击返", "回按钮退出游戏", "游戏更新"};
        imgArray = new Image[4];
        try {
            //箭头图片
            this.imgArray[0] = ResManager.createImage(90000041);
            //蓝色光片
            this.imgArray[1] = Tools.createPicFromGrayscale(ResManager.createImage(90000029), 0x0099ff);
            //背景图片
            //#if NORMAL_240_400
//#             imgArray[2] = ResManager.createImage(90000017);
//#             imgArray[2] = Tools.ZoomImage(imgArray[2], Constant.DRAW_WIDTH, Constant.DRAW_HEIGHT);
            //#else
            this.imgArray[2] = ResManager.createImage(90000017);
            //#endif
            this.imgArray[3] = ResManager.createImage(90000043);//确定、返回图片
        } catch (Exception e) {
            if (Constant.DEBUG) {
                e.printStackTrace();
            }
        }
    }

    public void clearUpdate() {
        this.imgArray = null;
        sArray = null;
    }

    public void updateUpdate() {
        if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_POSITIVE, false)
                || (MainCanvas.keyPressedLogic(Constant.GAME_KEY_FIRE, false))) {
//            String strurl = "http://www.163.com";
            Tools.printLog("Constant.UPDATE_URL  :::  " + Constant.UPDATE_URL);
            try {
                if (Constant.DEBUG) {
                    MainCanvas.addLog("platformRequest:" + "strurl" + Constant.UPDATE_URL);
                }
                MainGame.instance.platformRequest(Constant.UPDATE_URL);
                try {
                    Thread.sleep(2000);
                } catch (InterruptedException e) {
                    if (Constant.DEBUG) {
                        e.printStackTrace();
                    }
                }
                MainGame.instance.quitApp();
            } catch (Exception e) {
                if (Constant.DEBUG) {
                    e.printStackTrace();
                }
            }
        }
        if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_NEGATIVE, false)) {
            MainGame.instance.quitApp();
        }
    }

    public void drawUpdate(Graphics g) {
        Tools.drawFrame(g,
                Constant.UI_START_X, Constant.UI_START_Y,
                this.imgArray[2],
                this.imgArray[0],
                this.imgArray[1],
                this.imgArray[3],
                0, 0, 24, 12,
                this.imgArray[3], 49, 0, 23, 12,
                this.sArray[5], 0xFFFFFF);
        for (int i = 0; i < sArray.length; i++) {
            Tools.drawShadowString(g, (byte) 1, sArray[i],
                    (Constant.DRAW_WIDTH - Constant.FONT_SMALL.stringWidth(sArray[0])) / 2,
                    30 + i * 30,
                    0xffffff, 0x000000);
        }
    }

    public void initNetworkSelect() {
        sArray = new String[]{"联网设置", "移动梦网", "GPRS", "请确认选择的联网方式和您的手机设置一致，CMNET和联通用户请选GPRS!"};
        //#if NOKIA_S60V5
         imgArray = new Image[7];
         imgArray[0] = Tools.makeBlueMask();//蓝色光片
         imgArray[1] = ResManager.createImage(90000017);//背景图片
         imgArray[2] = Tools.makeTransparent(Constant.DRAW_WIDTH, 10, 150, 0x232323);//半透背景图片
         imgArray[3] = ResManager.createImage(90000043);//确定、返回图片
         imgArray[4] = ResManager.createImage(90000084);//方向键
         imgArray[5] = ResManager.createImage(90000085);//确定键
         imgArray[6] = ResManager.createImage(90000086);//底部蓝条
        //#else
//#        imgArray = new Image[4];
//#        imgArray[0] = Tools.makeBlueMask();//蓝色光片
        //#if NOKIA_S40V3  || MOTO || K790
        //#elif NORMAL_240_400
//# //        imgArray[1] = ResManager.createImage(90000017);
//# //        imgArray[1] = Tools.ZoomImage(imgArray[1], Constant.DRAW_WIDTH, Constant.DRAW_HEIGHT);
        //#else
//#        imgArray[1] = ResManager.createImage(90000017);//背景图片
        //#endif
//#        imgArray[2] = Tools.makeTransparent(Constant.DRAW_WIDTH, 10, 150, 0x232323);//半透背景图片
//#        imgArray[3] = ResManager.createImage(90000043);//确定、返回图片
        //#endif
        this.h = Tools.getParagraphHeight(sArray[3], Constant.DRAW_WIDTH - 30, Constant.FONT_SMALL_HEIGHT + 5);

    }

    public void drawNetWorkSelect(Graphics g) {
        //#if NOKIA_S60V5
         Tools.drawS60V5Frame(g, imgArray[1], imgArray[4], imgArray[5], imgArray[6], null, sArray[0]);
         Tools.drawShadowString(g, (byte) 1, this.sArray[2], Constant.UI_START_X + 15, Constant.UI_START_Y + Constant.DRAW_HEIGHT - 47 + (47 - Constant.FONT_SMALL_HEIGHT >> 1), 0x00FFCC, 0x000000);
         Tools.drawShadowString(g, (byte) 1, this.sArray[1], Constant.UI_START_X + Constant.DRAW_WIDTH - 15, Constant.UI_START_Y + Constant.DRAW_HEIGHT - 47 + (47 - Constant.FONT_SMALL_HEIGHT >> 1), 0x00FFCC, 0x000000, g.RIGHT | g.TOP);
         Tools.drawParagraph(g, Constant.UI_START_X + 15, Constant.UI_START_Y + (Constant.END_LINE - this.h >> 1), Constant.DRAW_WIDTH - 30, this.sArray[3], 0xFFFFFF, Constant.FONT_SMALL_HEIGHT + 1, 0x000000);
        //#else
//#        Tools.drawFrame(g, imgArray[1], imgArray[0], this.sArray[1], this.sArray[2], this.sArray[0]);
//#        Tools.drawParagraph(g, Constant.UI_START_X + 15, Constant.UI_START_Y + (Constant.DRAW_HEIGHT - this.h >> 1), Constant.DRAW_WIDTH - 30, this.sArray[3], 0xFFFFFF, Constant.FONT_SMALL_HEIGHT + 1, 0x000000);
//#
        //#endif
    }

    public void updateNetWorkSelect() {
        if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_POSITIVE, false)) {
//            GameBean.BY_NET_CONNECT = 1;
            Rms.saveGame(Constant.RMS_PLAYER_NETWORK, null);
            MainLogic.getInstance().uiInterFace.sysMessage.showMessage("提示", "联网方式设置成功!您现在设置的联网方式是<k移动梦网>！", (byte) 1, Constant.GAME_UI_OPTION_LIST);
        } else if (MainCanvas.keyPressedLogic(Constant.GAME_KEY_NEGATIVE, false)) {
//            GameBean.BY_NET_CONNECT = 2;
            Rms.saveGame(Constant.RMS_PLAYER_NETWORK, null);
            MainLogic.getInstance().uiInterFace.sysMessage.showMessage("提示", "联网方式设置成功!您现在选择的联网方式是<kGRPS>", (byte) 1, Constant.GAME_UI_OPTION_LIST);
        }
        MainCanvas.clearInput();
    }

    public void clearNetWorkSelect() {
        this.sArray = null;
        this.imgArray = null;
    }

	public void checkTouchCreateRole(int x, int y) {
		UiLogin uiLogin = MainLogic.getInstance().uiLogin;
		int[][]touchrect = null;//(int[][]) s_uiTouch.get(key);

//		if (touchrect == null) {
		switch (uiLogin.byUiState) {
		case 0:
			touchrect = new int[][] {
					{0,0,0,0},
					{ 0, 64, 360, 64 },
					{ 0, 145, 360, 64 },
					{ 0, 230, 360, 64 },
					{ 0, 312, 360, 64 },
					};
			break;
		case 1:
			break;
		case 2:
			touchrect = new int[][] {
					{0,0,0,0},
					{ 110, 295, 115, 20 },
					{ 110, 316, 115, 20 },
					{ 110, 337, 115, 20 },
					{ 110, 357, 115, 20 },
					};
			break;
		case 3:
			break;
		case 4:
			break;
		}
//			s_uiTouch.put(key, touchrect);
//		}
		if(touchrect== null)
			return;
		int touched = MainCanvas.checkTouch(x, y, touchrect);
		if (touched >=0) {
			switch(uiLogin.byUiState) {
			case 0:
				if (uiLogin.bySelectIndex == touched) {
					MainCanvas.pressFire();
				} else {
					if (!uiLogin.bUiKeyPressLock) {
						uiLogin.bySelectIndex  = (byte) touched;
	                    int start_Y = 41;
	                    int rect_H = Constant.FONT_SMALL.getHeight() * 3 + 8;
	                    int rect_Y = (Constant.NEW_END_LINE - start_Y - rect_H * 4) / 5;
	                    uiLogin.iArray = new int[]{2, 1, start_Y + (uiLogin.bySelectIndex) * (rect_H + rect_Y), 2, 50, 5};
	                   //#else
	                   //#if NOKIA_E72
	//#                             Tools.updateE72ScollBar(((bySelectIndex - 1) * (-27)));
	                   //#endif
	//#                            iArray = new int[]{2, 1, Constant.UI_START_Y + 20 + (bySelectIndex) * 68 + UiInterFace.iScreenOffsetH, 2, 50, 5};
	                   //#endif
	                    uiLogin.bUiKeyPressLock = true;
					}
				}
				break;
			case 1:
				break;
			case 2:
                //弹出层状态更改
                if (uiLogin.byPopState < 4) {
                	uiLogin.byPopState++;
                    if (uiLogin.byPopState == 4) {
                    	uiLogin.bUiKeyPressLock = false;
                    }
                }
                //
                //确定和取消的箭头动画效果
                uiLogin.bFlag = uiLogin.bFlag ? false : true;
                if (!uiLogin.bUiKeyPressLock) {
                	System.out.println("iSelectIndex="+uiLogin.iSelectIndex);
					if (uiLogin.iSelectIndex == touched) {
						if (touched == 1 || touched == 2) {
							MainCanvas.pressDir(3);
						} else {
							MainCanvas.pressFire();
						}
					} else {
						if (uiLogin.iSelectIndex < touched) {//向下
							uiLogin.iSelectIndex = touched;
                            //#if NOKIA_S60V5
							uiLogin.iLineConfigArray = new int[]{1, 1, Constant.UI_START_Y + Constant.END_LINE - 110 + uiLogin.iSelectIndex * 20, 2, 10, 5};
                            //#else
//#                                this.iLineConfigArray = new int[]{1, 1, Constant.UI_START_Y + Constant.DRAW_HEIGHT - 137 + 39 + (iSelectIndex - 1) * 20, 2, 10, 5};
                            //#endif
							uiLogin.bUiKeyPressLock = true;
							uiLogin.iState = 4;
						} else {
							uiLogin.iSelectIndex = touched;
							uiLogin.iLineConfigArray = new int[]{2, 1, Constant.UI_START_Y + Constant.END_LINE - 110 + uiLogin.iSelectIndex * 20, 2, 10, 5};
                             //#else
//#                                this.iLineConfigArray = new int[]{2, 1, Constant.UI_START_Y + Constant.DRAW_HEIGHT - 137 + 39 + (iSelectIndex - 1) * 20, 2, 10, 5};
                             //#endif
							 uiLogin.bUiKeyPressLock = true;
                             uiLogin.iState = 3;
						}

					}
                }
				break;
			case 3:
				break;
			case 4:
				break;
			}

		} else {
			MainCanvas.checkSoftKey();
		}
	}

	public void checkTouchSet(int x, int y) {
		Integer key = new Integer(MainLogic.getInstance().byGameState);
		UiLogin uiLogin = MainLogic.getInstance().uiLogin;
		int[][] touchrect = (int[][]) MainCanvas.s_uiTouch.get(key);

		if (touchrect == null) {

			int size = uiLogin.sArray.length;
			touchrect = new int[size][];
			int startx = Constant.UI_START_X + (Constant.DRAW_WIDTH - Constant.FONT_SMALL.stringWidth(uiLogin.sArray[1]) >> 1);
			int starty = Constant.UI_START_Y + ((Constant.DRAW_HEIGHT - 41 - 58) - (uiLogin.sArray.length - 1) * uiLogin.h >> 1)
            + (uiLogin.h - Constant.FONT_SMALL_HEIGHT >> 1);
			touchrect[0] = new int[]{0,0,0,0};
			for (int i = 1; i < size; i++) {
				touchrect[i] = new int[] { startx,
						starty + uiLogin.h * (i - 1), 80, uiLogin.h };
			}

			MainCanvas.s_uiTouch.put(key, touchrect);
		}
		int touched = MainCanvas.checkTouch(x, y, touchrect);
		if (touched >=0) {
			if (uiLogin.bySelectIndex == touched) {
				MainCanvas.pressFire();
			} else {
				uiLogin.bUiKeyPressLock = true;
				uiLogin.bySelectIndex = (byte) touched;//(byte) (uiLogin.bySelectIndex == sArray.length - 1 ? 1 : bySelectIndex + 1);
	            //#if NOKIA_S60V5
	            uiLogin.startY = Constant.UI_START_Y + ((Constant.DRAW_HEIGHT - 41 - 58) - (uiLogin.sArray.length - 1) * uiLogin.h >> 1)
	                     + (uiLogin.bySelectIndex - 1) * uiLogin.h;
	            //#else
	//#                        startY = Constant.UI_START_Y + ((Constant.DRAW_HEIGHT - 21 - 25) - (sArray.length - 1) * h >> 1)
	//#                                + (bySelectIndex - 1) * h;
	            //#endif
	             uiLogin.iArray = new int[]{1, 1, uiLogin.startY, 2, 50, 5};
			}
		}
		MainCanvas.checkSoftKey();

	}
}
